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
Explain how can you tell whether two strings are the same?
What is indirection?
How can I pad a string to a known length?
Simplify the program segment if X = B then C ← true else C ← false
Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?
A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers
In c language can we compile a program without main() function?
What are preprocessor directives in c?
Describe explain how arrays can be passed to a user defined function
What is the significance of an algorithm to C programming?
What does a derived class inherit from a base class a) Only the Public members of the base class b) Only the Protected members of the base class c) Both the Public and the Protected members of the base class d) .c file
Explain the difference between ++u and u++?
What does printf does?
Describe dynamic data structure in c programming language?
What is the right type to use for boolean values in c? Is there a standard type? Should I use #defines or enums for the true and false values?