#include //for stndr input
#include
main()
{ while(1) //for continuous value print
{
int choice,a,b,s,p,r,t,v; //variables
printf("\n1.addition");
printf("\n2.subtraction");
printf("\n3.multiplication");
printf("\n4.find odd-even");
printf("\n5.division");
printf("\n6.compund instrest");
printf("\n7.exit\n");
printf("\nenter your choice\n\n");
scanf("%d",&choice);
switch(choice) //switch case
{
case 1: //case declear
printf("\nenter your numbers\n");
scanf("%d%d",&a,&b);
s=a+b;
printf("\nsum of %d\n",s); //output value of 1st case
break;
case 2:
printf("\n enter your numbers\n");
scanf("%d%d",&a,&b);
s=a-b; //defind case
printf("\n value is %d\n",s);
break; //break is also important for switch case
case 3:
printf("enter your two numbers\n") ;
scanf("%d%d",&a,&b);
s=a*b;
printf("multiplication of %d",s);
break;
case 4:
printf("enter a number\n");
scanf("%d",&a);
if(a%2==0)
printf("number is even\n");
else
printf("number is odd\n");
break;
case 5:
printf("\nenter your first division number then by divisible\n");
scanf("%d%d",&a,&b);
s=a/b;
printf("value is %d\n",s);
break;
case 6:
printf("enter your values\nprincipal\nrate\ntime\n");
scanf("%d%d%d",&p,&r,&t);
v=(p*r*t)/100;
printf("value is %d\n",v);
getch();
case 7: //exit case
printf("press enter to exit\n");
exit(0);
break;
default: //default value is also important
printf("invalid choice");
break;
getch(); //for hold the screen/display
}}
}
Comments
Post a Comment