Resources » Articles/Knowledge Sharing » Computer & Technology

Write a Program To sort the elements of an array using “Bubble Sort”.


Posted Date: 07-Feb-2010  Last Updated:   Category: Computer & Technology    
Author: Member Level: Silver    Points: 2


Write a Program To sort the elements of an array using “Bubble Sort”.



Write a Program To sort the elements of an array using “Bubble Sort”.

SOURCE CODE:


#include
#include
void main()
{
int num[9],i,j,temp;
clrscr();
printf("This Program is Used to Sort the Elements of an Array Using Bubble Sorting");
printf("\n\nEnter The Elements:");
for(i=1;i<=9;i++)
{
scanf("%d",num[i]);
}
for(i=1;i<=9;i++)
{
for(j=9;j>i;j--)
{
if(num[j] {
temp=num[j];
num[j]=num[j-1];
num[j-1]=temp;
}
}
}
printf("\n\nThe Sorted Elements Are......");
for(i=1;i<=9;i++)
{
printf("\n\t%d",num[i]);
}
printf("\n\n\t\t\tTHANKYOU!");
getch();
}


OUTPUT

This program is used to Sort the Elements of an array using Bubble Sorting
Enter the Element:17 25 82 9 83
76 12 1 79
The sorted Elements Are:
1
9
12
17
25
76
79
83
92
ThankYOU.


Did you like this resource? Share it with your friends and show your love!




Responses to "Write a Program To sort the elements of an array using “Bubble Sort”."

No responses found. Be the first to respond...

Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Submit Article     Return to Article Index

    Awards & Gifts
    Active Members
    TodayLast 7 Daysmore...

    Online Members

    uma shankar
    More...
    ISC Technologies, Kochi - India. Copyright © All Rights Reserved.