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 a #include preprocessor?
What is an array in c?
What is your stream meaning?
Calculate 1*2*3*____*n using recursive function??
Write a C program to count the number of email on text
How can I rethow can I return a sequence of random numbers which dont repeat at all?
How can I call a function with an argument list built up at run time?
How can a process change an environment variable in its caller?
If I have a char * variable pointing to the name of a function ..
When do you not use the keyword 'return' when defining a function a) Always b) Never c) When the function returns void d) dfd
A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference
What is difference between && and & in c?
c programs are converted into machine language with the help of a) an interpreter b) a compiler c) an operatinf system d) none of the above
What does c mean in basketball?
Explain the difference between exit() and _exit() function?