program C++ Urutan bilangan

#include “conio.h”

#include “iostream.h”

void main()

{

int a,b,c,d,max,min;

cout<<“masukan nilai a=”;cin>>a;

cout<<“masukan nilai b=”;cin>>b;

cout<<“masukan nilai c=”;cin>>c;

cout<<“masukan nilai d=”;cin>>d;

if(a>b)

if(a>c)

if(a>d)

{max =a;

}

 

if(b>c)

if(b>d)

if(b>a)

{max =b;

}

 

if(c>a)

if(c>b)

if(c>d)

{max =c;

}

 

else

if(d>a)

if(d>b)

if(d>c)

{max =d;}

cout<<“bilangan maksimum = “<<max<<endl;

 

if(a<b)

if(a<c)

if(a<d)

{min =a;

}

 

if(b<c)

if(b<d)

if(b<a)

{min =b;

}

 

if(c<a)

if(c<b)

if(c<d)

{min =c;

}

 

else

if(d<a)

if(d<b)

if(d<c)

{min =d;}

cout<<“bilangan minimum = “<<min<<endl;

getch();

}

 

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s