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
|
#include<stdio.h>
void addition();
void multiplication();
void division();
int main()
{
int opr;
printf("Renzo's calculator\n\n");
printf("Choose any desired operator\n");
printf("A: Addition\n\n");
printf("B: Multiplication\n\n");
printf("C: Division\n\n");
scanf("%d", &opr);
if (opr == 'A')
addition();
if (opr == 'B')
multiplication();
if (opr == 'C')
division();
return 0;
}
void addition()
{
int add1, add2, result;
printf("Input two number to be added\n");
scanf("%d", &add1);
scanf("%d", &add2);
result = add1+add2;
printf("%d", result);
}
void multiplication()
{
int mul1,mul2,result;
printf("Input numbers to be multiplied\n");
scanf("%d", &mul1);
scanf("%d",&mul2);
result = mul1*mul2;
printf("%d", result);
}
void division()
{
int div1,div2,result;
printf("Input numbers to be divided\n");
scanf("%d", &div1);
scanf("%d", &div2);
result = div1/div2;
printf("%d", result);
}
|