Wednesday, August 10, 2011

Greatest of two numbers using relational conditional operators

program to find greatest of 2 numbers without using relational and 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();
}

No comments:

Post a Comment