Write a c program to sort in ascending order of n numbers, Computer Engineering

Assignment Help:

Write a C program to sort in ascending order of n numbers.

# include

# include

void main()

{

int a[25],no,i,j,m,t;

clrscr();

printf("\nEnter Total number of inputs : ");

scanf("%d",&no);

printf("\nEnter %d number : ",no);

no--;

for(i=0;i<=no;i++)

scanf("%d",&a[i]); /* Enter array elements */

for(i=0;i<=no;i++) /* Number of Passes */

{

for(j=0;j

/*Compare an element with the next element one by one*/

{

if(a[j]

{

t=a[j]; /* Interchange the two if first is smaller */

a[j]=a[j+1];

a[j+1]=t;

}

}

}

printf("\n Sorted numbers are :\n");

for(i=0;i<=no;i++)

printf("%d",a[i]);

getch();

}

 


Related Discussions:- Write a c program to sort in ascending order of n numbers

Data structure, what are the fundamental data structures

what are the fundamental data structures

What are types of applets, There are two different parts of applets. Truste...

There are two different parts of applets. Trusted Applets and Untrusted applets. Trusted Applets are applets with predefined security and Untrusted Applets are applets without any

Communication displays and matrix, Communication displays give support in d...

Communication displays give support in determining the frequency of communication, whether congestion in message queues or not, volume and the type of patterns being communicated e

DBMS, Difference between Paperbase and computer base system?

Difference between Paperbase and computer base system?

What is micro operation, What is micro operation? A micro operation is ...

What is micro operation? A micro operation is an elementary operation performed with the data kept in registers.   1) Register transfer microoperation transfer binary inform

Algorithm to insert a key in b-tree, Algorithm to insert a key in B-tree is...

Algorithm to insert a key in B-tree is as follows: 1.  First search is completed for the place where the new record must be put. As the keys are inserted, they are sorted into

What is magento, Magento is a feature-rich eCommerce platform built on open...

Magento is a feature-rich eCommerce platform built on open-source technology that gives online merchants with unprecedented flexibility and control over the look, content and funct

Show arithmetic subtraction, Q. Show Arithmetic Subtraction? The subtra...

Q. Show Arithmetic Subtraction? The subtraction can be done easily using 2's complement by taking 2's complement of value which is to be subtracted (inclusive of sign bit) and

Explain neural networks, A neural network can be definite as a model of rea...

A neural network can be definite as a model of reasoning based on the human brain. The human brain incorporates nearly 10 billion neurons and 60 trillion connections, Synapses amon

What is the main function of a browser, The main function of a browser is t...

The main function of a browser is to? The important function is to interpret HTML of a browser.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd