Menampilkan Nilai Maksimum dan Minimum Dengan Masukan Nilai Bilangan

Posted by Budi Arieyanto | Posted in | Posted on 02.45

#include<iostream.h>
#include<stdio.h>
#include<conio.h>

void main()
{
    int x,y,z,terbesar, terkecil;
   cout<<"masukkan bilangan  X = ";
   cin>>x;
   cout<<"masukkan bilangan  Y = ";
   cin>>y;
   cout<<"masukkan bilangan  Z = ";
   cin>>z;
   if ((x>=y)&&(x>=z))
     {
         terbesar=x;
     }
   else
    {
       if (y>=z)
          terbesar = y;
      else
          terbesar = z;
     }
   cout<<"Nilai Maksimum adalah = "<<terbesar;
   cout<<"\n";
    if ((x<=y)&&(x<=z))
     {
         terkecil=x;
     }
   else
    {
       if (y<=z)
          terkecil = y;
      else
          terkecil = z;
     }
   cout<<"Nilai Minimum adalah  = "<<terkecil;
   cout<<"\n";
   getch();
}

Comments (0)

Posting Komentar