-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLOC-Q-4.c
38 lines (38 loc) · 991 Bytes
/
LOC-Q-4.c
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>
void main()
{
float a,b,func;
int modfunc;
char sym,x;
printf("Enter a arithmetic symbol->(+,-,*,/,%%)-- ");
scanf("%s",&sym);
printf("Enter 1st number-");
scanf("%f",&a);
printf("Enter 2nd number-");
scanf("%f",&b);
switch(sym)
{
case '+':
func=a+b;
printf("Sum of %f & %f is %f- %f",a,b,func);
break;
case '-':
func=a-b;
printf("Diff of %f & %f is- %f",a,b,func);
break;
case '*':
func=a*b;
printf("Product of %f & %f is- %f",a,b,func);
break;
case '/':
func=a/b;
printf("Division of %f by %f is- %f",a,b,func);
break;
case '%':
modfunc=(int)a%(int)b;
printf("Modulus of %f by %f is- %d",a,b,modfunc);
break;
default:
printf("-No Choice-");
}
}