7. Write a Menu Driven program in which you have to perform addition, subtraction, multiplication and division.

Posted: August 26, 2012 in Lab 6
#include<stdio.h>
#include<conio.h>
int main()
{
int a,b,c,d,e,f,ch;
printf("Enter 1st no\n");
scanf("%d",&a);
printf("Enter 2nd no\n");
scanf("%d",&b);
printf("Enter choice 1.add 2.sub 3.mul 4.div\n");
scanf("%d",&ch);
switch(ch)
{
case 1:
c=a+b;
printf("%d",c);
break;
case 2:
d=a-b;
printf("%d",d);
break;
case 3:
e=a*b;
printf("%d",e);
break;
case 4:
f=a/b;
printf("%d",f);
break;
}
return 0;
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s