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

What is main function in c?

551


How can I swap two values without using a temporary?

619


What are data structures in c and how to use them?

681


Can a pointer be static?

626


How is pointer initialized in c?

588






Explain pointers in c programming?

637


Multiply an Integer Number by 2 Without Using Multiplication Operator

324


How can a process change an environment variable in its caller?

657


Define the scope of static variables.

607


what do you mean by inline function in C?

619


How many types of operator or there in c?

605


Write a program to print “hello world” without using semicolon?

675


What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?

626


`write a program to display the recomended action depends on a color of trafic light using nested if statments

1634


WRITE A PROGRAM TO MERGE TWO SORTED ARRAY USING MERGE SORT TECHNIQUE..

1599