forked from sushish-kumar/cpp-hacktoberfest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalculator.cpp
More file actions
44 lines (26 loc) · 668 Bytes
/
calculator.cpp
File metadata and controls
44 lines (26 loc) · 668 Bytes
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
#include<stdio.h>
int add(int a, int b){
int sum = a + b;
return sum;
}
int sub(int a, int b){
int subtract = a - b;
return subtract;
}
int mul(int a, int b){
int product = a * b;
return product;
}
float div(float a, float b){
float divide = a / b;
return divide;
}
int main(){
int a = 32;
int b = 17;
int sum = add(a,b);
int diff = sub(a,b);
float frac = div(a,b);
int prod = mul(a,b);
printf(" %d is the sum of the two numbers\n %d is the difference of the two numbers\n %d is the product of the two numbers\n %.2f is the product of division of the two numbers",sum,diff,prod,frac);
}