Program to print the greatest of two numbers using relational conditional operators

Write a program to print the greatest of two numbers using relational conditional operators

#include<stdio.h>
#include<conio.h>
#include<math.h>

void main(void)
{
            int a,b;
            clrscr();
            printf("Enter a number: ");
            scanf("%d",&a);
            printf("Enter another number: ");
            scanf("%d",&b);
            printf("The greatest number is %d",(a+b+abs(a-b))/2);
            getch();           
}


Post a Comment