logo image

C Language program to find largest number from given 2 numbers

Views: 14

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

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

	printf("Enter first number:");
	scanf("%d", &input1);

	printf("Enter second number:");
	scanf("%d", &input2);

	if (input1 == input2) {
		printf("%d is equal to %d ", input1, input2);

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

	} else {
		printf("%d is lesser than %d", input1, input2);



Enter first number: 20
Enter second number: 30
20 is lesser than 30 


Enter first number: 50
Enter second number: 50
50 is equal to 50 


Enter first number: 100
Enter second number: 60
100 is larger than 60 
We are looking for Interns!
Send your resumes to
[email protected]