forked from swaaz/basicprograms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogram70.c
More file actions
38 lines (38 loc) · 1.07 KB
/
Copy pathprogram70.c
File metadata and controls
38 lines (38 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include<stdio.h>
int main()
{
char op;
float number1,number2,result;
for(int i=0; i<5;i++)
{
printf("\nEnter\n + for Addition \n - for Subtraction \n * for Multiplication \n / for Division");
printf("\nEnter the operation you want to perform\n");
scanf("%s",&op);
printf("Enter two numbers\n");
scanf("%f %f",&number1,&number2);
switch(op)
{
case'+':result=number1+number2;
printf("Sum is %f\n",result);
break;
case'-':result=number1-number2;
printf("Difference is %f\n",result);
break;
case'*':result=number1*number2;
printf("Product is %f\n",result);
break;
case'/':if(number2==0)
{
printf("Division not possible\n");
}
else
{
result=number1/number2;
printf("Quotient is %f\n",result);
}
break;
default:printf("Enter proper input\n");
}
}
return 0;
}