hi, could someone please help me,
i am trying to write a menu driven c program using switch case.
its a program which should have menu as 1.add, 2.sub, 3.mul, 4.div
i wrote this but cannot get output... someone please correct me...
[code]
#include <stdio.h>
void main()
{
int opt,a,b,sum,sub,mul,div;
printf("\n1.add");
printf("\n2.sub");
printf("\n3.mul");
printf("\n4.div");
printf("\nenter your choice");
scanf("%d",&opt);
switch(opt)
{
case 1:
case add:
printf("enter a & b values");
scanf("%d%d",&a,&b);
sum=a+b;
printf("%d",sum);
break;
case 2:
case sub:
printf("enter a & b values");
scanf("%d%d",&a,&b);
sub=a-b;
printf("%d",sub);
break;
default:
printf("enter correct option");
}
}
[\code]
please help