To find the Maximum value of Two Numbers using simple if

Program:

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

Output:

Enter any Two Numbers : 10    20
Maximum Value is : 20


Next Topic        :  

Previous Topic :

No comments:

Post a Comment