Here are the two best methods to find the largest of three numbers in C.
The code are here as follow:-
✅ Method 1: Using if–else
#include <stdio.h>
int main()
{
int a, b, c;
printf("Enter three numbers: \n");
scanf("%d %d %d", &a, &b, &c);
if (a >= b && a >= c) {
printf("%d is the largest.", a);
}
else if (b >= a && b >= c) {
printf("%d is the largest.", b);
}
else
{
printf("%d is the largest.", c);
}
return 0;
}
✅ Method 2: Using Logical Operators
Tags:
C courses