12-Write a C program to find the greatest number among three numbers.

Program: 12

Write a C program to find the greatest number among three numbers.

#include
#include
void main()
{
    int a, b, c;
    printf("Enter A: ");
    scanf("%d", &a);
    printf("Enter B: ");
    scanf("%d", &b);
    printf("Enter C: ");
    scanf("%d", &c);
if(a>b)
{
    if(a>c)
  {

       printf("The value of A = %d is greatest.", a);
    }
    else
        printf("The value of C = %d is greatest.", c);
}
else
{
    if(b>c)
    {
        printf("The value of B = %d is greatest.", b);
    }
   else
       printf("The value of C = %d is greatest.", c);
}
getch();
}
Output
Enter A: 34

Enter B: 3

Enter C: 76

The value of C = 76 is greatest

 

Lokesh Kumar: Being EASTER SCIENCE's founder, Lokesh Kumar wants to share his knowledge and ideas. His motive is "We assist you to choose the best", He believes in different thinking.
Related Post
Leave a Comment

This website uses cookies.