Senin, 12 Mei 2014

Program Perhitungan Luas & Keliling Persegi Panjang (Java:BlueJ)

import java.util.Scanner;
public class luas_keliling_persegi{
public static void main(String[]rn){
    int panjang,lebar,luas,keliling;
    Scanner S = new Scanner (System.in);
    System.out.print(" Program Perhitungan Luas & Keliling Persegi Panjang");
        System.out.print("\n\t   Universitas Indraprasta PGRI");
        System.out.print("\n====================================================");
    System.out.print("\nmasukan panjang   = ");
    panjang=S.nextInt();
    System.out.print("masukan lebar     = ");
    lebar=S.nextInt();
    luas=(panjang*lebar);
    keliling=2*(panjang+lebar);
    System.out.print("====================================================");
    System.out.println("\nluas persegi panjang adalah       = "+luas);
    System.out.println("keliling persegi panjang adalah   = "+keliling);
    System.out.print("====================================================");
    System.out.println("\nProgram By : R-N");
        }
}

Output

1 komentar: