-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest31.c
69 lines (63 loc) · 1.2 KB
/
test31.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//Objective - Multiple Functions
//Date - Oct. 17, 2018
#include <stdio.h>
#include <conio.h>
int sum(){
int n1,n2;
printf("Enter 2 numbers ");
scanf("%d%d",&n1,&n2);
return (n1+n2);
}
int sub(){
int n1,n2;
printf("Enter 2 numbers ");
scanf("%d%d",&n1,&n2);
return (n1-n2);
}
int prod(){
int n1,n2;
printf("Enter 2 numbers ");
scanf("%d%d",&n1,&n2);
return (n1*n2);
}
int div(){
int n1,n2;
printf("Enter 2 numbers ");
scanf("%d%d",&n1,&n2);
return (n1/n2);
}
void main()
{
int sum(void);
int sub(void);
int prod(void);
int div(void);
int sm,sb,pro,divi,choice,n;
printf("18BCAN036\n\n");
printf("1 - Sum of 2 numbers\n");
printf("2 - Difference of 2 numbers\n");
printf("3 - Product of 2 numbers\n");
printf("4 - Division of 2 numbers\n\n");
printf("Enter your choice ");
scanf("%d",&choice);
switch(choice){
case 1:{
sm=sum();
printf("Sum is %d",sm); break;
}
case 2:{
sb=sub();
printf("Difference is %d",sb); break;
}
case 3:{
pro=prod();
printf("Product is %d",pro); break;
}
case 4:{
divi=div();
printf("Quotient is %d",divi); break;
}
default: printf("Error");
}
getch();
}