Nama : Lia Novita Sari Junaidi
Npm : 201402148
Jurusan : Sistem Informasi
Kelas : 1 A
Program C++, mengurutkan
bilangan terbesar ke terkecil.
#include <iostream.h>
#include <conio.h>
main(){
int a,b,c,max,i,mum;
cout<<"bilangan pertama: " ; cin>>a;
cout<<"bilangan kedua : " ; cin>>b;
cout<<"bilangan ketiga : " ; cin>>c;
if (a>b) {
if (a>c) {
if (b>c) {
max =a; i=b; mum=c;
} else {
max=a; i=c; mum=b;
}
} else {
max=c; i=a; mum=b;
}
} else {
if (b>c) {
if (a>c){
max=b; i=a; mum=c;
} else {
max=b; i=c; mum=a;}
} else {
max=c; i=b; mum=a;}
}
cout << max << "," << i << "," << mum;
getch();
}