write a program to sort the elements in a given array in c
language
Answer Posted / bhagya
#include<stdio.h>
#include<conio.h>
void main()
{
int a[5];
int i,j=0;
printf("enter 5 values into the array a");
for(i=0;i<5;i++)
{
scanf("%d",&a[i]);
}
printf("the sorted order of elements");
for(i=0;i<5;i++)
{ t=a[i];
for(j=0;j<5;j++)
{
if(a[i]>a[j])
a[i]=a[j];
a[j]=t;
}
}
}
| Is This Answer Correct ? | 144 Yes | 123 No |
Post New Answer View All Answers
What is struct node in c?
Explain how do you list files in a directory?
What is define c?
Which is better between malloc and calloc?
In a header file whether functions are declared or defined?
int i=3; this declaration tells the C compiler to a) reserve space in memory to hold the integer value b) associate the name i with this memory location c) store the value 3 at this location d) all the above
Are comments included during the compilation stage and placed in the EXE file as well?
main use of recursive function a) processing speed high b) reduce program length/reduce repeated statements c) if you do not, use iterative methods like, for, while or do-while d) all the above
Why & is used in c?
What is chain pointer in c?
Why calloc is better than malloc?
How a string is stored in c?
What's the difference between constant char *p and char * constant p?
what is the basis for selection of arrays or pointers as data structure in a program
What is linear search?