write a program to sort the elements in a given array in c
language
Answer Posted / yoyo
#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]=t;
a[i]=a[j];
a[j]=t;
}
}
}
| Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
Explain why C language is procedural?
Why we write conio h in c?
Write the control statements in C language
Why do we use c for the speed of light?
What are the scope of static variables?
how to execute a program using if else condition and the output should enter number and the number is odd only...
What is the difference between text files and binary files?
What is external variable in c?
What is a header file?
cin.ignore(80, _ _);This statement a) ignores all input b) ignores the first 80 characters in the input c) ignores all input till end-of-line d) iteration
What is extern keyword in c?
Why clrscr is used after variable declaration?
Explain what are multibyte characters?
Why n++ execute faster than n+1 ?
what are the different storage classes in c?