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
how many errors in c explain deply
What is a floating point in c?
Is linux written in c?
Explain the term printf() and scanf() used in c language?
What is #pragma statements?
Explain do array subscripts always start with zero?
Are the outer parentheses in return statements really optional?
What is the full form of getch?
Write a C Program That Will Count The Number Of Even And Odd Integers In A Set using while loop
Function which gives a pointer to a binary trees const an integer value at each code, return function of all the nodes in binary tree.?
Why c is a mother language?
Explain what is the use of a semicolon (;) at the end of every program statement?
what is event driven software and what is procedural driven software?
What is formal argument?
What are types of functions?