#include <conio.h>
#include <iostream.h>
main(){
int a[10];
int x,y,i,jumdata;
int m;
cout<<"Program Mengurutkan Angka Oleh Firman"<<endl;
cout<<endl;
cout<<"input jumlah data = ";
cin>>jumdata;
for(i=0;i<=jumdata-1;i++){
cout<<"input a ke-"<<i+1<<"= ";
cin>>a[i];
}
for(x=0;x<=jumdata-2;x++){
for(y=x+1;y<=jumdata-1;y++){
if(a[x]>a[y]){
m=a[x];a[x]=a[y];a[y]=m;
}
}
}
for(i=0;i<=jumdata-1;i++){
cout<<a[i]<<" ";
}
getch();
}
Tidak ada komentar:
Posting Komentar