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

how does the C compiler interpret the following two statements p=p+x; q=q+y; a.p=p+x; q=q+y b.p=p+xq=q+y c.p=p+xq; q=q+y d.p=p+x/q=q+y

4 Answers   TCS,


What is the significance of an algorithm to C programming?

0 Answers  


WHOT IS CHAR?

4 Answers   TCS,


ASCII stands for

1 Answers  


How to reverse a linked list

1 Answers   Aricent, Fidelity, IBM, TCS,






What is the use of extern in c?

0 Answers  


1,1,5,17,61,217,?,?.

3 Answers   Apple,


I want tcs placement papers of 2004-2009 , its urgent

6 Answers   TCS, Wipro,


1.)how to find d most repeated word in a string? string ="how do you do"?? output should be do

1 Answers   AAS, Nagarro, Vuram,


Explain the concept and use of type void.

0 Answers  


Is r written in c?

0 Answers  


What is difference between union All statement and Union?

0 Answers  


Categories