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
How can you find the day of the week given the date?
How is pointer initialized in c?
what is different between auto and local static? why should we use local static?
To print the pattern 1 2 3 4 5 10 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9
Write an algorithm for implementing insertion and deletion operations in a singly linked list using arrays ?
What is console in c language?
Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.
What is function what are the types of function?
What is assignment operator?
how to execute a program using if else condition and the output should enter number and the number is odd only...
What are the types of data types and explain?
A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference
Why is c called c not d or e?
Explain how can I make sure that my program is the only one accessing a file?
What are the 4 types of functions?