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 #ifdef ? What is its application?

0 Answers   TCS,


What is the use of define in c?

0 Answers  


What is a stream water?

0 Answers  


What is file in c preprocessor?

0 Answers  


C language questions for civil engineering

0 Answers   Tech Mahindra,






please can some one guide me, to the answer Write a C program to enter 15 numbers as an input from the keyboard and program will find and print odd numbers and their average. i have studied while and do while loop for loop if and else if switch

2 Answers  


How can I implement sets or arrays of bits?

0 Answers  


1. Write a c pgm to print 1 to 100 without using loops. 2. Write a c pgm for leap year 3. Write a c pgm fibbonacci series,factorial 4. Write a c pgm count no of lines , blanks, tabs in a para(File concept) 5. Write a c pgm to print the letter as per given condition i.e.. if u give 4 out put should b 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 6.how do get the o/p in number from 1 to 100 in the screen without using control statement? 7. who do u print the word "hello world" without using "printf" statement? 8. write sql program to get the detail of student in a class? Definitions: structure union arrays linkedlist macros directives difference b/w pre processorsDiffrence: 1.Constructors and destructors 2.Structure and Union 3.Array and Lists 4.pre processor... 5. Privillages in C++ 6.structure and union 7.break and continue 8.while and dowhile Pgm..

3 Answers  


What functions are in conio h?

0 Answers  


If an old women's age is the same as her three grand daughters i,mean the number of days old child=the no of weeks old child=no of months old child .The total yrs of all these ppl is 114 yrs...then how old is the old woman? the yr has 365 days..and 30 days each month.

1 Answers   TCS,


What do you mean by command line argument?

0 Answers   TCS,


print ur name 20,000 times without using inbuilt library functions like printf,scanf,gets,puts,getchar or putchar

4 Answers   IBM,


Categories