SORTING USING BUBBLE SORT
BCA Third semester
Data Structure
#include<stdio.h>
#include<conio.h>
void main()
{
int arr[5],i,j,temp;
clrscr();
for(i=0;i<5;i++)
{
printf(“Enter elements”);
scanf(“%d”,&arr[i]);
}
for(i=0;i<5;i++)
{
for(j=i+1;j<5;j++)
{
if(arr[i] > arr[j])
{
temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
}
}
for(i=0;i<5;i++)
{
printf(” %d “,arr[i]);
}
getch();
}
OUTPUT
Enter Elements : 40
Enter Elements : 10
Enter Elements : 30
Enter Elements : 60
Enter Elements : 20
After Sorting :
10 20 30 40 60
- install our bcanotesnepal application from the play store: BCA Notes NepalDo does not forget to like our Facebook page: www.facebook.com/bcanotesnepal
Facebook Groups https://www.facebook.com/groups/bcanotesnepal
Join In our Facebook Group https://www.facebook.com/groups/1200219363518714/
if you need a Downloadable link once message us on-page you can get at a time.
This post is posted for not further third-party purposes.
Copyright By:- Bcanotesneapl
Not allowed to upload these notes to other sites.
Like our Facebook Page https://www.facebook.com/bcanotesnepal/
if you want to download this PDF comment on us we will provide you a downloadable link.
if you like please share this post with your friend who studies in BCA
if you have any query please comment below,
if you like our sites. you can visit again for the latest updates notes of different BCA subjects of Presentation and different topics with assignment questions and solutions.
Don’t forget to like our page and post also share with your friend and having your group.
if you have any questions you can drop or share them with me using the comment box I will try to answer your question.
Like our Facebook Page https://www.facebook.com/bcanotesnepal/