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

Explain how can you tell whether two strings are the same?

580


What is indirection?

649


How can I pad a string to a known length?

610


Simplify the program segment if X = B then C ← true else C ← false

2581


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?

576






A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers

650


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

576


What are preprocessor directives in c?

632


Describe explain how arrays can be passed to a user defined function

604


What is the significance of an algorithm to C programming?

596


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

665


Explain the difference between ++u and u++?

635


What does printf does?

742


Describe dynamic data structure in c programming language?

603


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?

604