generated from nuwank7/IT1050-Tutorial-01
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tute04.c
41 lines (37 loc) · 868 Bytes
/
Tute04.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
/*Exercise 4 - Functions
Implement the three functions minimum(), maximum() and multiply() below the main() function.
Do not change the code given in the main() function when you are implementing your solution.*/
#include <stdio.h>
int minimum(int no1 , int no2);
int maximum(int no1 , int no2);
int multiply(int no1, int no2);
int main() {
int no1, no2;
printf("Enter a value for no 1 : ");
scanf("%d", &no1);
printf("Enter a value for no 2 : ");
scanf("%d", &no2);
printf("%d ", minimum(no1, no2));
printf("%d ", maximum(no1, no2));
printf("%d ", multiply(no1, no2));
return 0;
}
int minimum(int no1 , int no2){
if (no1 <= no2){
return no1;
}
else{
return no2;
}
}
int maximum(int no1 , int no2){
if (no1 >= no2){
return no1;
}
else{
return no2;
}
}
int multiply(int no1, int no2){
return no1 * no2;
}