Skip to content
Home » C Program to Find Largest of Three Numbers Using AND (&&) operator

C Program to Find Largest of Three Numbers Using AND (&&) operator

Learn about C Program to Find Largest of Three Numbers Using AND (&&) operator in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.

C Program to Find Largest of Three Numbers Using AND (&&) operator

Program:

#include<stdio.h>
int main()
{
   int num1, num2, num3;

   printf("Enter three numbers: ");
   scanf("%d %d %d",&num1,&num2,&num3);

   if(num1>=num2 && num1>=num3)
     printf("Largest=%d\n",num1);
   else if(num2>=num1 && num2>=num3)
     printf("Largest=%d\n",num2);
   else
     printf("Largest=%d\n",num3);

   return 0;
}

Output:

Enter three numbers: 4 2 3
Largest=4

Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.

Similar Codes :
C program to find the largest of three numbers using nested if-else statements
C Program to Find Grade of Student using nested if-else statements