Program :-
#include < stdio.h >
main () {
int a,b;
int c,m;
do{
printf("\n enter the operands");
scanf("%d%d",&a,&b);
printf("enter the operations :1.addition 2.Subtraction 3.Multiplication 4.Division 5.Reminder"); scanf("%d",&c);
if(c == 1){
printf("%d + %d=%d",a,b,a+b);
else if(c == 2)
printf("%d - %d=%d",a,b,a-b);
else if(c == 3)
printf("%d * %d=%d",a,b,a*b);
else if(c == 4)
printf("%d / %d=%d",a,b,a/b);
else if(c == 5)
printf("%d % %d=%d",a,b,a%b);
else
printf("invalid option");
printf("do you want to continue ?,if yes then enter 1 else 0);
scanf("%d",&m);
}
while(m == 1);
}
Output :-
enter the operands4
5
enter the operations :1.addition 2.Subtraction 3.Multiplication 4.Division 5.Reminder
1
4 + 5 = 9
do you want to continue ?,if yes then enter 1 else 0
0
No comments:
Post a Comment