C Program to Find the Largest Number Among Three Numbers



 c program to find the largest number among three numbers

Learn C - C tutorial - c program to find the largest number among three numbers - C examples - C programs

C Program to Find the Largest Number Among Three Numbers

  • This code will find largest number using two methods - if else and conditional operators.
  • It will take three inputs and find largest number among them.

Sample Code

#include <stdio.h>
int main()
{
    double n1=37,n2=62,n3=78;
    printf("Three Different Numbers:56,28,15\n");
    if( n1>=n2 && n1>=n3 )
        printf("%.2f is the largest number.", n1);
    if( n2>=n1 && n2>=n3 )
        printf("%.2f is the largest number.", n2);
    if( n3>=n1 && n3>=n2 )
        printf("%.2f is the largest number.", n3);
    return 0;
}

Output

Three Different Numbers:56,28,15
78.00 is the largest number.


View More Quick Examples


Related Searches to C Program to Find the Largest Number Among Three Numbers