C Program For Arithmetic Operations

#include<stdio.h>
#include<conio.h>
int main()
{
int a,b,ch;
float result;
clrscr();
printf("select the operation from list");
printf("\n 1.ADDITION \n 2.SUBSTRACTION");
printf("\n 3.MULTIPLICATION \n 4.DIVISION");
printf("\n Enter your choice:");
scanf("%d",&ch);
switch(ch)
{
case1: printf("\n enter two numbers:");
scanf("%d%d",&a,&b);
result=a+b;
printf("\n result=%f",result);
break;
case2: printf("\n enter two numbers:");
scanf("%d%d",&a,&b);
result=a-b;
printf("\n result=%f",result);
break;
case3: printf("\n enter two numbers:");
scanf("%d%d",&a,&b);
result=a*b;
printf("\n result=%f",result);
break;
case4: printf("\n enter two numbers:");
scanf("%d%d",&a,&b);
result=a/b;
printf("\n result=%f",result);
break;
}
getch();
}

No comments:

Post a Comment

Copyright © EduRAR @ www.edurar.blogspot.in