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 switch in c?

0 Answers  


How to develop software using "c" programming?

1 Answers   IBM, TCS,


main() { char ch='356'; Printf("%d",ch); } *OUTPUT*:- -18 *Why?*

1 Answers  


What is difference between scanf and gets?

0 Answers  


What is main () in c language?

0 Answers  






What is a function in c?

0 Answers  


du u know test pattern for robosoft? Plz share

1 Answers   RoboSoft, TATA, Wipro,


write a c program to accept a given integer value and print its value in words

4 Answers   Vernalis, Vernalis Systems,


Write the Program to reverse a string using pointers.

0 Answers   InterGraph,


CAN WE DEFINE ANY FUNCTION WITHIN A FUNCTION.

15 Answers  


Explain how can you determine the size of an allocated portion of memory?

0 Answers  


where does it flourished?

0 Answers   Microsoft,


Categories