forked from CPRF-Session2/Assignment2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththreenums.c
More file actions
35 lines (27 loc) · 973 Bytes
/
Copy paththreenums.c
File metadata and controls
35 lines (27 loc) · 973 Bytes
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
/*Mariposa Lee, numbers are equal*/
#include <stdio.h>
int main () {
printf("Please enter three different numbers.\n");
int Num1, Num2, Num3, sum;
scanf("%d %d %d", &Num1, &Num2, &Num3);
sum = Num1 + Num2 + Num3;
if (Num1 == Num2 && Num1 == Num3){
printf("The numbers are equal.\n");}
else { printf("The numbers are not equal.\n");
if (Num1 > Num2 && Num1 > Num3){
printf("The largest number is %d.\n", Num1);}
else if (Num2 > Num1 && Num2 > Num3){
printf("The largest number is %d.\n", Num2);}
/* If 2 out of 3 numbers are the same:*/
else if (Num1 == Num2 && Num1 > Num3){
printf("The largest number is %d.\n", Num1);}
else if (Num2 == Num3 && Num2 > Num1){
printf("The largest number is %d.\n", Num2);}
else if (Num1 == Num3 && Num1 > Num2){
printf("The largest number is %d.\n", Num1);}
/*If the third number is the largest number:*/
else{
printf("The largest number is %d.\n", Num3);}
printf("The sum of all 3 numbers is %d.\n", sum);
} return 0;
}