Rabu, 06 Juli 2011

Menncari nilai maximum

import jeliot.io.*;

public class maximum {

public void masuk(){
      System.out.print("nilai a : ");
      a=Input.readInt();
      System.out.print("nilai b : ");
      b=Input.readInt();
}


public void proses(){
      max=a;
      if(b>a) max=b;
      if(a>b) max=a;
}

public void keluar(){
      System.out.println("nilai maximum = "+max);
}

private int a,b,max;

public static void main() {
      maximum zaki=new maximum();
      x.masuk();
      x.proses();
      x.keluar();
    }
}

0 komentar:

Posting Komentar

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Blogger Theme by Lasantha - Premium Blogger Templates | Affiliate Network Reviews