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 sizeof know array size?

0 Answers  


Explain what are linked list?

0 Answers  


Why c language?

0 Answers  


What is structure padding & expalain wid example what is bit wise structure?

1 Answers  


What are structure members?

0 Answers  


while initialization of array why we use a[][2] why not a[2][]...?

0 Answers   Aptech,


What should not contain a header file?

2 Answers  


When should the const modifier be used?

0 Answers  


Write a small C program to determine whether a machine's type is little-endian or big-endian.

5 Answers   nvidia,


Write a code to generate a series where the next element is the sum of last k terms.

0 Answers   Aspiring Minds,


main() { float a=3.2e40; printf("%d",a); }

9 Answers   Satyam,


which one is better structure or union?(other than the space occupied )

2 Answers  


Categories