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 process of writing the null pointer?

0 Answers  


#define d 10+10 main() { printf("%d",d*d); }

6 Answers  


Why header files are used?

0 Answers  


please send me the code for multiplying sparse matrix using c

0 Answers  


Why is python slower than c?

0 Answers  






Write a program to compute the following 1!+2!+...n!

4 Answers  


Write the program with at least two functions to solve the following problem. The members of the board of a small university are considering voting for a pay increase for their 10 faculty members. They are considering a pay increase of 8%. Write a program that will prompt for and accept the current salary for each of the faculty members, then calculate and display their individual pay increases. At the end of the program, print the total faculty payroll before and after the pay increase, and the total pay increase involved.

0 Answers   Convergys,


What are the different types of control structures in programming?

0 Answers  


Explain the difference between null pointer and void pointer.

0 Answers   TCS,


write a program in c language for the multiplication of two matrices using pointers?

8 Answers   Ignou,


How can I implement sets or arrays of bits?

0 Answers  


Explain what is a pragma?

0 Answers  


Categories