Showing posts with label program to find greatest of 2 numbers without using relational and conditional operators. Show all posts
Showing posts with label program to find greatest of 2 numbers without using relational and conditional operators. Show all posts

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();
}

Labels