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 volatile c?
How does sizeof know array size?
Do variables need to be initialized?
Why is c fast?
What is the difference between int main and void main?
What is define c?
1) write a program to generate 1st n fibonacci prime numbers using Nested if 2) write a program to generate twin prime numbers from m to n using nested if 3) write a program to check whether a given integer is a strong number or not using nested if 4) Write a program to generate prime factors of a given integer using nested if 5)write a program to generate prime numbers from m to n using nested if 6)write a program to generate perfect numbers from m to n using nested if 7)write a program to generate the pallindromes from m to n using neste if 8)write a program to generate armstrong numbers from m to n using nested if 9)write a program to generate strong numbers from m to n using nested if
In which language linux is written?
Explain how can a program be made to print the name of a source file where an error occurs?
Explain modulus operator.
What are the properties of union in c?
Explain the difference between getch() and getche() in c?
What is the behavioral difference when include header file in double quotes (“”) and angular braces (<>)?
Is null valid for pointers to functions?
What are volatile variables in c?