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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a code to achieve inter processor communication (mutual exclusion implementation pseudo code)?

691


Explain zero based addressing.

610


hi any body pls give me company name interview conduct "c" language only

1670


What does volatile do?

568


Why does everyone say not to use gets?

610






On most computers additional memory that is accessed through an adapter of feature card along with a device driver program. a) user memory b) conventional memory c) expandedmemory d) area

665


Why are all header files not declared in every c program?

602


What does 4d mean in c?

949


How can I change their mode to binary?

698


How can you tell whether a program was compiled using c versus c++?

620


Can we declare variable anywhere in c?

538


What is a example of a variable?

554


What is a class c rental property?

617


What is methods in c?

643


How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same

650