Saturday, April 11, 2009

PROG:- Add, Sub, Multi, Division

#include
#include
#include
void main()
{
int a,b,c,sum,div,sub,mul;
clrscr();
printf("enter ur choice");
printf("\n 1 Addition");
printf("\n 2 Subtraction");
printf(" \n 3 Multiplication");
printf("\n 4 Division");
printf("\n 5 Exit");
scanf("%d",&a);
printf("\n");

switch(a)
{

case 1:
printf("enter 2 no.s");
scanf("%d%d",&b,&c);
sum=b+c;
printf("ur result is %d",sum);
break;

case 2:
printf("enter 2 no.s");
scanf("%d%d",&b,&c);
sub=b-c;
printf("ur result is %d",sub);
break;

case 3:
printf("enter 2 no.s");
scanf("%d%d",&b,&c);
mul=b*c;
printf("ur result is %d",mul);
break;

case 4:
printf("enter 2 no.s");
scanf("%d%d",&b,&c);
div=a/b;
printf("ur result is %d",div);
break;

case 5:
exit(0);
break;

default:
printf("wrong choice");
}
getch();
}

No comments:

Post a Comment

Search This Blog