C Language program to find largest number from given 3 numbers


Following program shows you how to find largest number from given 3 numbers.
In this program we get inputs from user and shows largest number from given three numbers using if condition

#include <stdio.h>
int main() {
	int input1;
	int input2;
	int input3;

	printf("Enter three numbers:\n");
	scanf("%d", &input1);
	scanf("%d", &input2);
	scanf("%d", &input3);

	if ((input1 == input2) && (input1 == input3)) {
		printf("All numbers are equal");

	} else if ((input1 > input2) && (input1 > input3)) {
		printf("%d is larger than %d and %d", input1, input2, input3);

	} else if ((input2 > input1) && (input2 > input3)) {
		printf("%d is larger than %d and %d", input2, input1, input3);

	} else if ((input3 > input1) && (input3 > input2)) {
		printf("%d is larger than %d and %d", input3, input2, input1);

	} 
}

Output:

Example1:

Enter three numbers:
 10
 10
 10
All numbers are equal 

Example2:

Enter three numbers:
 30
 30
 40
40 is larger than 30 and 30