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 are the types of bitwise operator?
What are the uses of null pointers?
What are the characteristics of arrays in c?
How can I call fortran?
How can you determine the size of an allocated portion of memory?
Why do we use stdio h and conio h?
How to get string length of given string in c?
What are the types of macro formats?
What is bubble sort technique in c?
Explain what is the difference between functions abs() and fabs()?
What are the 5 types of inheritance in c ++?
What is the difference between null pointer and wild pointer?
Hai what is the different types of versions and their differences
What is structure in c explain with example?
How can I manipulate strings of multibyte characters?