Archive for the ‘CODE’ Category

Program for Calculator

August 28, 2010

//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…:)

(more…)