• Slide 1 Title

    Go to Blogger edit html and replace these slide 1 description with your own words. ...

  • Slide 2 Title

    Go to Blogger edit html and replace these slide 2 description with your own words. ...

  • Slide 3 Title

    Go to Blogger edit html and replace these slide 3 description with your own words. ...

  • Slide 4 Title

    Go to Blogger edit html and replace these slide 4 description with your own words. ...

  • Slide 5 Title

    Go to Blogger edit html and replace these slide 5 description with your own words. ...

Subscribe via email

Enter your email address:

Delivered by FeedBurner

Friday, 4 February 2011

Simple Calculator in C



//Program for Calculator
#include<stdio.h>
#include<conio.h>
void main()
{
float n1,n2;
char c,s;
clrscr();
printf("Enter the Values for Calculation [e.g:1+2]\n\n");
scanf("%f%c%f",&n1,&c,&n2);
if(c=='+')
printf("\n%f",n1+n2);
if(c=='-')
printf("\n%f",n1-n2);
if(c=='*')
printf("\n%f",n1*n2);
if(c=='/')
printf("\n%f",n1/n2);
printf("\nDo you wish to Continue[y/n]");
scanf("%s",&s);
if(s=='y'||s=='Y')
main();
}

Hope you liked my posts, give comments if you have any doubts.. :)
Categories:

0 comments:

Post a Comment

 
  • Recent Articles

  • Popular Articles

  • Recent Comments