To find the Maximum value of Three numbers using simple if

 Program:

#include<stdio.h>
#include<conio.h>
void main()
{
    int a, b, c, max;
    clrscr();
    printf("Enter any Three Numbers : ");
    scanf("%d%d%d", &a, &b, &c);
    max=a;
    if(max<b)
    {
        max=b;
    }
    if(max<c)
    {
        max=c;
    }
    printf("Maximum Value is : %d", max);
    getch();
}


Output:

Enter any Three Numbers : 10    20    30
Maximum Value is : 30


Next Topic        :  

Previous Topic :

No comments:

Post a Comment