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

Conversion of decimal number 25.5 into binary number, Conversion of decimal...

Conversion of decimal number 25.5 into binary number Ans. There is integer part is 25 and fractional part is 0.5.  Firstly convert the integer part 25 in its equal to binary numb

Why a computer expect to receive responses, Why a computer expect to receiv...

Why a computer expect to receive responses when it broadcast an ARP request? Response will be acquired only from the machine for that request is being sent not for the other ma

State and prove any one of the demorgen''s laws, Q. F(x,y,z) = ∑m (4,6,7,8...

Q. F(x,y,z) = ∑m (4,6,7,8)+ ∑d (2,5,11,12) Using K-Map. Q. State and prove any one of the DeMorgen's Laws. Show that these theorems can be extended up to any number of variabl

Critical path analysis, Given the information provided in Table 1: ...

Given the information provided in Table 1: Prepare an Activity on the Node (AON) Network Diagram ( I recommend you  use MS Project or any drawing tool); Prepare

Comparator, 6 bit magnitude comparator

6 bit magnitude comparator

Briefly define the term isotype, Question: (a) (i) Briefly define the t...

Question: (a) (i) Briefly define the term "Isotype". (ii) With the help of diagrams, describe the rules of "Isotype". (b) Elaborate on your understanding of internationa

COA, During instruction execution, there are other parts of the CPU that ca...

During instruction execution, there are other parts of the CPU that can determine when a physical register might be freed. Briefly describe where else we can put freeing logic and

Which function type is used for using "at exit-command", Which Function typ...

Which Function type has to be used for using "at exit-command" ? To Use AT EXIT - COMMAND, We must assign a function Type "E" to the relevant function in the MENU Painter OR S

Explain about control memory organization, Q. Explain about Control Memory ...

Q. Explain about Control Memory Organization? One of the simplest ways to organize control memory is to organize micro-instructions for different sub cycles of machine instruct

Explain direct broadcast & limited broadcast, Explain Direct broadcast & li...

Explain Direct broadcast & limited broadcast. Broadcast is a method to send a packet to all the stat ions on an exact network at once. Broadcast systems permit the possibility

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