Program to find greater number among three numbers using if else in c-language

Program to find greater number among three numbers using if else in c-language


#include<stdio.h>
int main()
{
    int a,b,c;
    printf("Enter first number\n");
    scanf("%d",&a);
    printf("Enter second number\n");
    scanf("%d",&b);
    printf("Enter third number\n");
    scanf("%d",&c);
    if(a>b&&a>c)
    {
        printf("Greatest number is=%d",a);
    }
    else if(b>a&&b>c)
    {
      printf("Greatest number is=%d",b) ;
    }
    else
    {
        if(c>a&&c>b)
        {
            printf("Greatest number is=%d",c);
            }
            else
            {
                printf("All number are equal");
            }
     
    }
}

OUTPUT
Enter first number
67
Enter second number
7
Enter third number
78
Greatest number is=78

By the help of this program you can compare three number and the largest number .And using this concept you can make many program of comparing 4 digit and more digit program.

If you like this program then you can share it and for any issues you can direct contact with me from Home Page.

For regular updates you can also follow my site.


Visit Homepage

Comments

Popular posts

Creative pattern of butterfly in C-language

Program to show present time and date in C-language

Introduction of C-language.

Program to cheque enter number is a perfect number or not using if else in C-language

Program to cheque four digits number is palindrome or not in C-language

Program to print the cube of a number in c-language

Simple Hello world program in c- language