#include<iostream>
using namespace std;
main ()
{
int i,a, masuk,data[100],simpan;
printf("NAMA : MUHAMAD HUSNI RAMADHAN \n");
printf("NIM : 191011400011 \n");
printf("KELAS : 02 TPLE 002 \n");
cout<<"Masukkan Banyak Bilangan:";
cin>>masuk;
for(i=0;i<masuk;i++)
{
cin>>data[i];
}
for(i=0;i<masuk;i++)
for(a=i+1;a<masuk;a++)
{
if(data[i]>data[a])
{
simpan=data[i];
data[i]=data[a];
data[a]=simpan;
}
}
cout<<" \n";
cout<<"hasil pengurutan:";
for(i=0;i<masuk;i++)
{
cout<<data[i]<<" \t";
}
}
Tidak ada komentar:
Posting Komentar