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
What is null pointer in c?
Explain what is the difference between null and nul?
Hi how many types of software editions are there and their difference (like home editions, enterprise, standard etc) can u please help me
Why is it usually a bad idea to use gets()? Suggest a workaround.
what is uses of .net
Tell me is null always defined as 0(zero)?
A collection of functions,calls,subroutines or other data a) library b) header files c) set of files d) textfiles
Why we write conio h in c?
What are multibyte characters?
What are the advantages of using linked list for tree construction?
Can variables be declared anywhere in c?
Explain how do you use a pointer to a function?
where are auto variables stored? What are the characteristics of an auto variable?
What does %p mean?
What is the difference between text and binary i/o?