Sunday, February 15, 2009

Exer3


#include
#include


void main(){
clrscr();
int choice,a,b,n,y,sum=0,sub=0,mul=0,div=0;

printf("\n\nSelect Operation");
printf("\n\n\n\t[A] for ADDITION");
printf("\n\t[B] for SUBTRACTION");
printf("\n\t[C] for MULTIPLICATION");
printf("\n\t[D] for DIVISION");
printf("\n\t[E] for EXIT");
printf("\n\nPlease enter the CAPITAL letter of the operation you choose:");
scanf("%s",&choice);
switch(choice)
{
case 'A':
printf("\n\nEnter your 1ST number pls: ");
scanf("%d",&a);
printf("Then enter the 2ND number pls: ");
scanf("%d",&b);
sum=a+b;
printf("\n\nSummation of two number is:%d",sum);
break;

case 'B':
printf("\n\nEnter your 1ST number pls: ");
scanf("%d",&a);
printf("Then enter the 2ND number pls: ");
scanf("%d",&b);
sub=a-b;
printf("\n\nDifference of two number is:%d",sub);
break;

case 'C':
printf("\n\nEnter your 1ST number pls: ");
scanf("%d",&a);
printf("Then enter the 2ND number pls: ");
scanf("%d",&b);
mul=a*b;
printf("\n\nProduction of two number is:%d",mul);
break;
case 'D':
printf("\n\nEnter your 1ST number pls: ");
scanf("%d",&a);
printf("Then enter the 2ND number pls: ");
scanf("%d",&b);
div=a/b;
printf("\n\nDivision of two number is:%d",div);
break;
}
getch(); }

No comments:

Post a Comment