#include <iostream>
#include <conio.h>
using namespace std;
int jumlah, desc;
main(){
cout<<"NAMA : MUHAMAD HUSNI RAMADHAN"<<endl;
cout<<"NIM : 191011400011 "<<endl;
cout<<"KELAS: 02TPLE002 "<<endl;
cout<<endl;
cout << "Masukan jumlah bilangan : ";
cin >> jumlah;
int nilai[jumlah];
for(int i=0; i<jumlah; i++){
cout << "Nomor " << (i+1) << " : ";
cin >> nilai[i];
}
for(int c=1;c<jumlah;c++)
{
for(int d=0;d<jumlah-c;d++)
{
if(nilai[d]<nilai[d+1])
{
desc=nilai[d];
nilai[d]=nilai[d+1];
nilai[d+1]=desc;
}
}
}
cout << endl << "Hasil Pengurutan Adalah";
for(int i=0;i<jumlah;i++)
{
cout << " " << nilai[i];
}
cout << endl;
getch();
return 0;
}
Tidak ada komentar:
Posting Komentar