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 structure in c explain with example?
Write a program to swap two numbers without using third variable in c?
write a program to copy the string using switch case?
How can I change their mode to binary?
hi send me sample aptitude papers of cts?
What is cohesion and coupling in c?
Can you explain the four storage classes in C?
Is using exit() the same as using return?
Which programming language is best for getting job 2020?
c language supports bitwise operations, why a) 'c' language is system oriented b) 'c' language is problem oriented c) 'c' language is middle level language d) all the above
what is stack , heap ,code segment,and data segment
Is c is a high level language?
What is d scanf?
Write a program to find factorial of a number using recursive function.
What are the types of pointers in c?