To find the maximum of two numbers using if-else

 Program:

#include<stdio.h>
#include<conio.h>
void main()
{
    int a, b, max;
    clrscr();
    printf("Enter any Two Numbers : ");
    scanf("%d%d", &a, &b);
    if(a>b)
        max=a;
    else
        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