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 stream and instruction stream-flynn’s classification, Data Stream an...

Data Stream and Instruction Stream The term 'stream' refers to an order or flow of either data operated or instructions on by the computer. In the complete chain of instructi

Convenience of environments -artificial intelligence , Convenience of Envir...

Convenience of Environments -artificial intelligence: In some cases, some aspects of an environment which should be taken into account in decisions about actions may be unavai

Explain various classes of datatypes of c, Explain various classes of datat...

Explain various classes of datatypes of C   Following are the main classes of data types in C language: 1.  Primary data types: Also called as fundamental/basic data types

What is software engineering, Software engineering is:- The application...

Software engineering is:- The application of a disciplined engineering move towards to the development of software systems. A body of information and knowledge in software d

Differentiate between absolute and relative poverty, Question 1: Using ...

Question 1: Using appropriate diagrams, describe the optimal provision of a private good and a public good. Question 2: Using appropriate diagram, show how there is an

Differentiate between public key and secret key encryption, What are the di...

What are the different between Public Key Encryption and Secret Key Encryption? Differentiate between Public Key Encryption and Secret Key Encryption: A cryptographic sys

Identify the main enhancements brought along by tkip, Question: (a) Id...

Question: (a) Identify the four main enhancements brought along by TKIP on WPA to solve the problems in WEP. (b) The term WarDriving has been frequently used while talking

What is insertion sort, What is insertion sort? Insertion Sort : One o...

What is insertion sort? Insertion Sort : One of the easiest sorting algorithms is the insertion sort. Insertion sort having of n - 1 passes. For pass p = 2 by  n, insertion so

What is redundant array of independent disks, What is Redundant Array of In...

What is Redundant Array of Independent Disks? Researchers are constantly trying to improve secondary storage media by raising their, performance, capacity as well as reliabilit

What are the steps to design algorithm, What are the steps to design algori...

What are the steps to design algorithm? Formulate algorithm for each operation. Analysis specification tells what the operation does. The algorithm shows how it is done. The st

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