Answer Posted / rama krishna sidhartha
//code for ascending order
for(i=0;i<n-1;i++)
{
for(j=1+1;j<n;j++)
{
if(a[j] >a[j])
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
//code for descending order
for(i=n-1;i>0;i--)
{
for(j=n;j>i+1;j--)
{
if(a[j]<a[j])
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
| Is This Answer Correct ? | 7 Yes | 4 No |
Post New Answer View All Answers
What is the purpose of void pointer?
what is a function method?give example?
How can I invoke another program (a standalone executable, or an operating system command) from within a c program?
Explain what is wrong in this statement?
What is the difference between local variable and global variable in c?
How can I send mail from within a c program?
Do you know the difference between malloc() and calloc() function?
Write a c program to build a heap method using Pointer to function and pointer to structure ?
An application package has been provided to you without any documents for the following application. The application needs to be tested. How will you proceed?
Want to know how to write a C program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.
What are the 5 data types?
What is identifier in c?
When should you use a type cast?
Can we compile a program without main() function?
What are the 5 types of inheritance in c ++?