C Program to Find Largest of Three Numbers

//WAP TO FIND THE LARGEST OF THE 3 NUMBERS

#include<stdio.h>
int main()
{
	int n1,n2,n3,temp;
	printf("Enter the number1 :--> ");
	scanf("%d",&n1);

	printf("Enter the number2 :--> ");
	scanf("%d",&n2);

	printf("Enter the number3 :--> ");
	scanf("%d",&n3);

	if(n1>n2)
	{
		if(n1 > n3)
		{
			printf("%d is the largest among three numbers",n1);
		}
		else
		{
			printf("%d is the largest among three numbers",n3);
		}
	}
	else
	{
		if(n2 > n3)
		{
			printf("%d is the largest among three numbers",n2);
		}
		else
		{
			printf("%d is the largest among three numbers",n3);
		}
	}

	return 0;

}

<< Previous | Next >>