Find the highest of three numbers and print them using ascending orders?



Find the highest of three numbers and print them using ascending orders?..

Answer / venugopal

#include<stdio.h>
main()
{
int a[3],i,f,s;
clrscr();
printf("enter 3 no's");
for( i=0;i<3;i++)
{
scanf("%d",&a[i]);
}
/* sorting starts here*/

for (f=0;f<3;f++)
{
for(s=f+1;s<3;s++)
{
if(a[s]<a[f])
{
temp=a[s];
a[s]=a[f];
a[f]=temp;
}
}
}
/* now sorted array is*/
for(int x=0;x<3;x++)
{
printf("%d",a[x]);
}
/* biggest elt is*/

printf("%d",a[2]);
getch();
}

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More C Interview Questions

what is difference between userlevel threads and kernel level threads ?what are the trades offs between these two approaches ? what approach is most frequently used and why ?

1 Answers  


here is a link to download Let_Us_C_-_Yashwant_Kanetkar

3 Answers   Microsoft,


What's the difference between DELETE TABLE and TRUNCATE TABLE commands?

2 Answers   CTC,


what is the difference between postfix and prefix unary increment operators?

3 Answers  


how can write all 1to 100 prime numbers using for loop,if and break ?

2 Answers   TCS,






What is the difference between typeof(foo) and myFoo.GetType()?

2 Answers   Synergy,


What should not contain a header file?

2 Answers  


Should I learn data structures in c or python?

0 Answers  


What is storage class?

0 Answers  


One of the Institutes contains 5 student groups. Every group contains 4 students. Institute wants to store student group’s details in array. Group should contain group member’s details (name and registration number and age), project name, and mark of the group.

0 Answers  


What is 'makefile' in C langauage? How it be useful? How to write a makefile to a particular program?

2 Answers  


void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }

0 Answers  


Categories