write a program that accepts 3 numbers from the user. dispaly
the values in a descending order.
Answer Posted / nitin garg
#include <stdio.h>
#include <conio.h>
#include <string.h>
int main()
{
int a,b,c;
printf("Enter Three Number
");
scanf("%d%d%d",&a,&b,&c);
if(a>b && a>c)
{
if(b>c)
printf("%d %d %d",c,b,a);
else
printf("%d %d %d",b,c,a);
}
if(b>a && b>c)
{
if(a>c)
printf("%d %d %d",c,a,b);
else
printf("%d %d %d",a,c,b);
}
if(c>a && c>b)
{
if(b>a)
printf("%d %d %d",a,b,c);
else
printf("%d %d %d",b,a,c);
}
getch();
}
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are the disadvantages of external storage class?
about c language
Explain how do you convert strings to numbers in c?
Write a function expand(s1,s2) that expands shorthand notations like a-z in the string s1 into the equivalent complete list abc...xyz in s2 . Allow for letters of either case and digits, and be prepared to handle cases like a-b-c and a-z0-9 and -a-z. z-a:zyx......ba -1-6-:-123456- 1-9-1:123456789987654321 a-R-L:a-R...L a-b-c:abbc
Can you return null in c?
What is difference between Structure and Unions?
Are negative numbers true in c?
How do c compilers work?
Write the control statements in C language
What is the advantage of c?
the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?
How can I determine whether a machines byte order is big-endian or little-endian?
Is null a keyword in c?
What is the use of c language in real life?
Explain union. What are its advantages?