Program to find larger of the two numbers without using if-else,while,for,switch

Answer Posted / nidhish mathew

#include<stdio.h>
#include<math.h>
int main()
{
int i,j;
scanf("%d%d",&a,&b);
printf("Greater Number is %d",(a+b+abs(a-b))/2);
printf("Smallest Number is %d",(a+b-abs(a-b))/2);
}

Is This Answer Correct ?    16 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how many errors in c explain deply

1819


State two uses of pointers in C?

811


if the area was hit by a virus and so the decrease in the population because of death was x/3 and the migration from other places increased a population by 2x then annually it had so many ppl. find our the population in the starting.

4800


Can a file other than a .h file be included with #include?

867


What is the difference between class and object in c?

805


What is modeling?

811


What is getch c?

1039


What is extern variable in c with example?

746


Explain the term printf() and scanf() used in c language?

798


What is a union?

789


What is array of structure in c programming?

989


program for reversing a selected line word by word when multiple lines are given without using strrev

2157


Who invented bcpl language?

917


Is null equal to 0 in sql?

857


Is array name a pointer?

799