C program for bubble sort, C/C++ Programming

C program for bubble sort:

void main()

{

int i,j,k,a[10],n;

clrscr();

printf("How many values you want to enter\n");

scanf("%d",&n);

 for(i=0;i<=n-1;i++)

 {

 printf(" %d no?\n",i+1);

 scanf("%d",&a[i]);

 }

                for (i=0;i<=n-1;i++)

                for(j=0;j

                 {

                  if (a[j]>a[j+1])

                    { k=a[j+1];

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

                      a[j]=k;

                     }

                  }

 for(i=0;i<=n-1;i++) printf("%d\n",a[i]);

 getch();

 }

Posted Date: 10/18/2012 6:29:56 AM | Location : United States







Related Discussions:- C program for bubble sort, Assignment Help, Ask Question on C program for bubble sort, Get Answer, Expert's Help, C program for bubble sort Discussions

Write discussion on C program for bubble sort
Your posts are moderated
Related Questions
Describe Processing an array? The Single operations which involve complete arrays are not permitted in C language. therefore if a and b are similar arrays (for example same dim

There is a pebble merchant. He sells the pebbles, that are used for shining the floor. His main duty is to take the length of the room’s sides. But he sometimes mistakes doing that

c program to find pebble merchant

There are formal ways of reducing Boolean expressions in order to minimize the logic circuit. The two elementary ways of minimization are using Boolean expressions/De Morgan Theore

WAP TO PRINT SERIES FROM 1 TO 10 & FIND ITS SQUARE AND CUBE # include stdio.h> # include conio.h> # include math.h>   void main () { int a=1,sqr=0,cube=0;

Hi is there any chance to get assignment for fresher tutor

write a c++ program, that finds the minimum total number of shelves, including the initial one, required for this loading process.

There are ''n'' ants on a ''n+1'' length rod. The ants are numbered from 1 to n and are initially placed at positions starting from position 1 till position n. They are moving eith

Create a program that asks the user for two integers which represent the numerator and denominator parts of fraction. Print out a simplification of the fraction. Example: Enter th

C CODE FOR PEBBLE MERCHANTS PROBLEM