Bubble Sourt Program in C++ With Source Code


#include<stdio.h>
#include<conio.h>

void main()
{
    clrscr();
    int i,j,temp;

    int List[5]={7,5,6,9,8};
    int n=5;
    i=0;
    while(i<n)
    {
        j=0;
        while(j<=n-i)
        {
            if(List[j]<List[j+1])
            {
                temp=List[j];
                List[j]=List[j+1];
                List[j+1]=temp;
            }
            j+=1;
        }

        i+=1;
    }
    printf("Descending order:\n");
    for(i=0;i<n;i++)
    {
        printf("%d\n",List[i]);
    }
    getch();

}
Bubble Sourt Program in C++ With Source Code Bubble Sourt Program in C++  With Source Code Reviewed by Unknown on 5:44:00 PM Rating: 5

No comments:

Powered by Blogger.