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


Please Help Members By Posting Answers For Below Questions

What is type qualifiers?

880


What is function prototype?

796


What are the 5 types of inheritance in c ++?

780


What does != Mean in c?

807


In c language can we compile a program without main() function?

851


How to write c functions that modify head pointer of a linked list?

758


Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

944


how can i write a program that prints out a box such that whenever i press any key8(coordinate number) on the keyboard, the box moves.

1456


What is a c token and types of c tokens?

828


How can I call a function with an argument list built up at run time?

928


What does double pointer mean in c?

796


What are different types of operators?

787


typedef struct{ char *; nodeptr next; } * nodeptr ; What does nodeptr stand for?

1404


How do you convert strings to numbers in C?

942


code for quick sort?

1826