C++ DEVELOPER SITE
PYTHONPHP7JAVA
 

Greatest of a Three Numbers


Given three numbers A, B and C; The task is to find the largest number among the three.

Below is the C program to find the largest among the three numbers:

#include <stdio.h>
  
int main()
{
    int A, B, C;
  
    printf("Enter the numbers A, B and C: ");
    scanf("%d %d %d", &A, &B, &C);
  
    if (A >= B && A >= C)
        printf("%d is the largest number.", A);
  
    if (B >= A && B >= C)
        printf("%d is the largest number.", B);
  
    if (C >= A && C >= B)
        printf("%d is the largest number.", C);
  
    return 0;
}

Output:

Enter the numbers A, B and C: 2 8 1 
8 is the largest number.