write a program that accepts 3 numbers from the user. dispaly
the values in a descending order.

Answers were Sorted based on User's Feedback



write a program that accepts 3 numbers from the user. dispaly the values in a descending order...

Answer / 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

write a program that accepts 3 numbers from the user. dispaly the values in a descending order...

Answer / anupama shelke

#include<stdio.h>
#include<conio.h>
main()
{
int a[3],i,j,temp;
clrscr();
for(i=0;i<3;i++)
{
printf("\nEnter the values:");
scanf("%d",&a[i]);
}
for(i=0;i<3;i++)
{
for (j=i+1;j<3;j++)
{
if(a[i]<b[i])
{
temp=a[i];
a[i]=b[i];
b[i]=temp;
}
}
}
for(i=0;i<3;i++)
{
printf("array is:%d",a[i])
}
getch();
return;
}

Is This Answer Correct ?    3 Yes 5 No

write a program that accepts 3 numbers from the user. dispaly the values in a descending order...

Answer / palani222samy

include<stdio.h>
int main()
{
int a,b,c;
printf("enter the a value")

Is This Answer Correct ?    2 Yes 5 No

Post New Answer

More C Interview Questions

what is the return value (status code) of exit() function.... what the arguments(integer value) passed to it means....

1 Answers   TCS,


who did come first hen or agg

15 Answers   Infosys,


#ifdef TRUE int I=0; #endif main() { int j=0; printf("%d %d\n",i,j); }

3 Answers   ADITI,


What is string constants?

0 Answers  


In C programming, how do you insert quote characters (‘ and “) into the output screen?

0 Answers  






Write a C Program That Will Count The Number Of Even And Odd Integers In A Set using while loop

0 Answers   HP,


what is the difference between call by value and call by reference?

5 Answers   Genpact, Global Logic, Infosys,


Define Spanning-Tree Protocol (STP)

0 Answers  


int n=1; while(1) { switch(n) { case 1:printf("a"); n++; continue; case 2:printf("b"); n++; continue; default : printf("c"); break; } break; }

1 Answers  


Is c functional or procedural?

1 Answers  


What is 2c dna?

0 Answers  


we all know about the function overloading concept used in C++ and we all learnt abt that.... but that concept is already came in C in a very smaller propotion ... my question is IN WHICH CONCEPT THERE IS A USE OF FUNCTION OVERLOADING IS USED in C language?????????????

4 Answers   Google,


Categories