-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu_prototipo_srmd.c
More file actions
81 lines (68 loc) · 1.51 KB
/
Copy pathmenu_prototipo_srmd.c
File metadata and controls
81 lines (68 loc) · 1.51 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
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
70
71
72
73
74
75
76
77
78
79
80
81
#include <stdio.h>
void menu();
void sumar();
void restar();
void multiplicar();
void dividir();
int main(){
menu();
return 0;
}
void menu(){
int opc;
do{
printf("\n\n\t opcion 1. Sumar");
printf("\n\n\t opcion 2. restar");
printf("\n\n\t opcion 3. multiplicar");
printf("\n\n\t opcion 4. dividir");
printf("\n\n\t opcion 5. Salir");
printf("\n\n\t opcion");
scanf("%i",&opc);
switch(opc){
case 1:sumar();break;
case 2:restar();break;
case 3:multiplicar();break;
case 4:dividir();break;
}
}while(opc !=5);
}
void sumar(){
int a, b, sum=0;
printf("\n\n\t digite el primer numero:");
scanf("%i",&a);
printf("\n\n\t digite el segundo numero:");
scanf("%i",&b);
sum=a+b;
printf("\n\n\t resultado:%d",sum);
scanf("%i",&a);
}
void restar(){
int a, b, rest=0;
printf("\n\n\t digite el primer numero:");
scanf("%i",&a);
printf("\n\n\t digite el segundo numero:");
scanf("%i",&b);
rest=a-b;
printf("\n\n\t resultado:%d",rest);
scanf("%i",&a);
}
void multiplicar(){
int a, b, mult=0;
printf("\n\n\t digite el primer numero:");
scanf("%i",&a);
printf("\n\n\t digite el segundo numero:");
scanf("%i",&b);
mult=a*b;
printf("\n\n\t resultado:%d",mult);
scanf("%i",&a);
}
void dividir(){
int a, b, div=0;
printf("\n\n\t digite el primer numero:");
scanf("%i",&a);
printf("\n\n\t digite el segundo numero:");
scanf("%i",&b);
div=a/b;
printf("\n\n\t resultado:%d",div);
scanf("%i",&a);
}