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
What are the different types of endless loops?
Where can I get an ansi-compatible lint?
What is register variable in c language?
Is it better to bitshift a value than to multiply by 2?
What are the standard predefined macros?
what are the different storage classes in c?
What are the main characteristics of c language describe the structure of ac program?
How are 16- and 32-bit numbers stored?
What is echo in c programming?
in any language the sound structure of that language depends on its a) character set, input/output function, its control structures b) character set, library functions, input/output functions its control structures c) character set, library functions, control sturctures d) character set, operators, its control structures
What is realloc in c?
What are the 5 types of organizational structures?
How does normalization of huge pointer works?
An expression to whose value an operater is applied a) operand b) variable c) constant d) all of the above
What is a function in c?