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 a pragma?
What happens if header file is included twice?
How many levels deep can include files be nested?
What are categories used for in c?
What are operators in c?
int i[2], j; int *pi;i[0] = 1; i[1] = 5; pi = i; j = *pi + 1 + *(pi + 1)Value of j after execution of the above statements will be a) 7 b) 6 c) 4 d) pointer
What are predefined functions in c?
How do you do dynamic memory allocation in C applications?
Discuss the function of conditional operator, size of operator and comma operator with examples.
What is main () in c language?
write a program to rearrange the array such way that all even elements should come first and next come odd
Why is c faster?
Write a program to identify if a given binary tree is balanced or not.
How can I find out the size of a file, prior to reading it in?
Is null equal to 0 in sql?