Sunday, September 23, 2012

Program 5 Create Simple Calculator


#include<stdio.h>
#include<conio.h>
void main()
{
int c,a,b,ch;
clrscr();
printf("Enter number of a A=");
scanf("%d",&a);
printf("Enter number of a B=");
scanf("%d",&b);
printf("\t1.Addition\n\t2.substraction\n\t3.multiplication\n\t4.devesion\n");

printf("enter your choice");
scanf("%d",&ch);

switch(ch)
{
case 1:
c=a+b;
printf("%d",c);
break;
case 2:
c=a-b;
printf("%d",c);
break;
case 3:
c=a*b;
printf("%d",c);
break;
case 4:
c=a/b;
printf("%d",c);
break;
default:
printf("un valide choice");
}
getch();
}

No comments:

Post a Comment