-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.c
57 lines (44 loc) · 1.01 KB
/
main.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
#include <stdio.h>
void divisao(int a, int b) {
float r = (float)a / b;
printf("O resultado da divisao: %f\n", r);
}
void soma(int a, int b) {
int r = a + b;
printf("O resultado da soma: %d\n", r);
}
void subtracao(int a, int b) {
int r = a - b;
printf("O resultado da subtracao: %d\n", r);
}
void multiplicacao(int a, int b) {
int r = a * b;
printf("O resultado da multiplicacao: %d\n", r);
}
int main() {
int op, a, b;
printf("**************************************************\n");
printf("********* Calculadora super ultra power **********\n");
printf("**************************************************\n");
printf("Digite operacao (0=soma, 1=sub, 2=mult, 3=div)\n");
scanf("%d", &op);
printf("Digite primeiro operando:\n");
scanf("%d", &a);
printf("Digite segundo operando:\n");
scanf("%d", &b);
switch(op) {
case 0:
soma(a, b);
break;
case 1:
subtracao(a, b);
break;
case 2:
multiplicacao(a, b);
break;
case 3:
divisao(a, b);
break;
}
return 0;
}