write a program to arrange the contents of a 1D array in
ascending order
Answer Posted / prakashmca
#include<stdio.h>
#include<conio.h>
void main()
{
int a[20],n,i,j,temp;
clrscr();
printf("\n enter the size of the array");
scanf("%d",&n);
printf("\n enter the contents of the array");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n-1;i++)
{
for(j=0;j<n;j++)
{
if(a[i]>a[j])
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
getch();
}
| Is This Answer Correct ? | 7 Yes | 14 No |
Post New Answer View All Answers
When c language was developed?
Explain how can I remove the trailing spaces from a string?
What is c programming structure?
What does the c preprocessor do?
What is the sizeof () operator?
a value that does not change during program execution a) variabe b) argument c) parameter d) none
What are the features of the c language?
How do we open a binary file in Read/Write mode in C?
What are the features of c languages?
What are the properties of union in c?
What is dynamic dispatch in c++?
Is c++ based on c?
Differentiate between static and dynamic modeling.
What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers
p*=(++q)++*--p when p=q=1 while(q<=6)