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

Explain basic time division and time switching method, What is time divisio...

What is time division switching? With the help of block diagram explain basic time division and time switching method. Time Division Switching: A switching component can be s

Power supply in computer system, Q. Power supply in computer system? Co...

Q. Power supply in computer system? Computer operate electronically- either by power supply attained from your electric plug or batteries in case of portable computers. Though

How much CMOS circuits consume power, CMOS circuits consume power ? An...

CMOS circuits consume power ? Ans. As in CMOS one device is ON and one is Always OFF therefore power consumption is low or can say less than TTL.

Vector processing, Vector Processing  A vector is an ordered set of the...

Vector Processing  A vector is an ordered set of the similar type of scalar data items. The scalar item can be a floating point number, a logical value or an integer. Vector pr

Computers and cntrol, Define open and closed loop cotrol systems.Explain di...

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example

No-signs to the write statement, Suppressing the number signs (+/-) is carr...

Suppressing the number signs (+/-) is carried out using the addition NO-SIGNS to the Write statement.  Statement is wrong.

What are the advantagesof fact finding, What are the Advantagesof fact find...

What are the Advantagesof fact finding - Analyst obtains reliable data - It's possible to see exactly what is being done -  This is an inexpensive method in comparison o

What is common language runtime, What is "Common Language Runtime" (CLR)?  ...

What is "Common Language Runtime" (CLR)?  CLR is .NET equivalent of Java Virtual Machine (JVM). It is the runtime that changes a MSIL code into the host machine language code,

How putchar function is used within a c program, How putchar function is us...

How putchar function is used within a C Program ? The following program reads each character in the first line of input entered at the terminal's keyboard. It uses putchar to d

Explain difference between risc and cisc, RISC-Means Reduced Instruction Se...

RISC-Means Reduced Instruction Set Computer. A RISC system has decreased number of instructions and more significantly it is load store architecture were pipelining can be executed

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