forked from coder2hacker/Explore-open-source
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhighest_num.c
43 lines (36 loc) · 868 Bytes
/
highest_num.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
// 9. Find the highest number in the given 4 numbers
#include <stdio.h>
int highest_num(int num1, int num2, int num3, int num4){
int highest_num;
if(num1 > num2){
if(num1 > num3){
if(num1 > num4){
highest_num = num1;
}else{
highest_num = num4;
}
}
}
else if (num2 > num3)
{
if(num2 > num4){
highest_num = num2;
}else{
highest_num = num4;
}
}
else if (num3 > num4)
{
highest_num = num3;
}else{
highest_num = num4;
}
return highest_num;
}
int main()
{
int num1, num2, num3, num4;
printf("Enter four numbers\n");
scanf("%d %d %d %d", &num1, &num2, &num3, &num4);
printf("Highest number in %d %d %d %d is %d", num1 , num2, num3, num4, highest_num(num1 , num2, num3, num4));
}