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
Why do we use stdio h and conio h?
what are the 10 different models of writing an addition program in C language?
an expression contains relational operators, assignment operators, and arithmatic operstors. In the absence of parentheses, they will be evaluated in which of the following order a) assignment, relational, arithematic b) arithematic, relational, assignment c) relational, arithematic, assignment d) assignment, arithematic, relational
What is a pointer variable in c language?
What are the 4 data types?
What is the difference between the local variable and global variable in c?
How can I read in an object file and jump to locations in it?
What is the purpose of the following code? Is there any problem with the code? void send(int count, short *to, short *from) { /* count > 0 assumed */ register n = (count + 7) / 8; switch (count % 8) { case 0: do { *to = *from++; case 7: *to = *from++; case 6: *to = *from++; case 5: *to = *from++; case 4: *to = *from++; case 3: *to = *from++; case 2: *to = *from++; case 1: *to = *from++; } while (--n > 0); } }
Do you know the use of 'auto' keyword?
any C program contains only one function, it must be a) void () b) main () c) message () d) abc ()
Can you apply link and association interchangeably?
What does d mean?
What are file streams?
List the difference between a 'copy constructor' and a 'assignment operator' in C?
Can a function argument have default value?