To find the Maximum and Minimum values between any Two Numbers

 Program:

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

Output:

Enter any Two Values : 10    20
Maximum Value is : 20
Minimum Value is : 10




Previous Topic :  Special Operators

No comments:

Post a Comment