Friday, 7 March 2014

Write a C program to find out greatest of three numbers. The numbers are given by the user.

#include<stdio.h>
main()
{
    int a,b,c;
    printf("\nEnter three numbers=");
    scanf("%d%d%d",&a,&b,&c);
    if(a>b && a>c)
    {
        printf("\n%d is greatest",a);
    }
    else if(b>c)
    {
        printf("\n%d is greatest",b);
    }
    else
    {
        printf("\n%d is greatest",c);
    }
}

No comments:

Post a Comment