#include<iostream.h>
#include<conio.h>
int main()
{
int a[30];
int i,n,j,temp;
cout<<"\n\t\t\t ^_^ Bubble SorTinG ^_^ \n\n";
cout<<"\n-> Enter The RanGe Of ArrAy --> ";
cin>>n;
for(i=1;i<=n;i++)
{
cout<<"\n\t\t Enter The "<<i<<" NumBer : ";
cin>>a[i];
}
for(i=1;i<=n;i++)
{
for(j=1;j<=n-1;j++)
{
if(a[j]>a[j+1])
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
cout<<"\n\n\n\t^_^ SorTeD ArrAy In AscEnDinG OrdeR :\n";
cout<<"\n\n";
for(i=1;i<=n;i++)
{
cout<< "\n\t\t NumBer : ";
cout<<a[i]<<"\n";
}
getch ();
}
- Blogger Comment
- Facebook Comment
Subscribe to:
Post Comments
(
Atom
)
0 comments:
Post a Comment