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


Please Help Members By Posting Answers For Below Questions

how many errors in c explain deply

1633


What is a floating point in c?

607


Is linux written in c?

603


Explain the term printf() and scanf() used in c language?

600


What is #pragma statements?

595






Explain do array subscripts always start with zero?

764


Are the outer parentheses in return statements really optional?

581


What is the full form of getch?

587


Write a C Program That Will Count The Number Of Even And Odd Integers In A Set using while loop

1719


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.?

632


Why c is a mother language?

560


Explain what is the use of a semicolon (;) at the end of every program statement?

740


what is event driven software and what is procedural driven software?

2019


What is formal argument?

654


What are types of functions?

571