Friday, 20 April 2018

Program To Input Two Number From User And Calculate Add,Sum,Multi,and Div Of The Number According To The Choice

/*program of menu driven program*/
# include <stdio.h>
void main ()
{
int a,b,c,choice ;
clrscr () ;
printf ("/n enter the first number :") ;
scanf ("%d", & a) ;
printf ("/n enter second number :");
scanf ("%d", & b) ;
printf ("/n you can perform the following operation :") ;
printf ("/n 1.addition :") ;
printf ("/n 2.subtraction :") ;
printf ("/n 3. multiplication :") ;
printf ("/n 4. division :") ;
printf ("/n enter your choice :") ;
scanf ("%d", & choice) ;
switch (choice)
{
case 1 ;
c= a+b ;
printf ("/n sum = %d", c) ;
break ;
case 2 ;
c= a-b ;
printf ("/n sub = %d", c) ;
break ;
case 3 ;
c= a*b ;
printf ("/n multi = %d", c) ;
break ;
case 4 ;
c= a\b ;
printf ("/n div = %d". c) ;
break ;
default :
printf ("/n invalid number :") ;
}
getch () ;
}

No comments:

Post a Comment

Featured post

Kalgudi Interview Round!!

Those who cleared the second round of kalgudi got an email from exceller to complete their Kalgudi Interview Round. So here we will discuss ...