Commit 99399728 by matjul

Upload New File

parent 27177ff3
Showing with 92 additions and 0 deletions
#include <stdio.h>
int mult(int x, int y);
float div(float x, float y);
int add(int x, int y);
int sub(int x, int y);
int main(){
int first;
int second;
int choice;
int result;
float resultf;
puts("Enter the numbers");
scanf("%d", &first);
scanf("%d", &second);
printf("The action with numbers:\n1 - mult\n2 - div\n3 - add\n4 - subs\n");
do{
puts("pick the numbers");
scanf("%d", &choice);
}
while(choice < 1 || choice > 4);
switch(choice){
case 1:
puts("multiplication");
result = mult(first, second);
printf("%d", result);
break;
case 2:
puts("division");
resultf = div(first, second);
printf("%f", resultf);
break;
case 3:
puts("adding");
result = add(first, second);
printf("%d", result);
break;
case 4:
puts("substracting");
result = sub(first, second);
printf("%d", result);
break;
}
return 0;
}
int mult(int x, int y){
int A;
A = x * y;
return A;
}
float div(float x, float y){
float B;
B = x / y;
return B;
}
int add(int x, int y){
int C;
C = x + y;
return C;
}
int sub(int x, int y){
int D;
D = x - y;
return D;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment