*****Selamat Datang Di Blog Manajement Informatika Polibisnis Perdana Mandiri*****
*****Jangan lupa untuk memberi kritik dan saranya!!!*****

Selasa, 13 Maret 2012

Contoh Progam Java (Latihan IF B2)

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package latihan.pkgif.b2;

import java.util.Scanner;

/**
 *
 * @author Administrator
 */
public class LatihanIFB2 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner masukan = new Scanner(System.in);
System.out.println("Masukkan bilangan");
int bilangan = masukan.nextInt();
if (bilangan%2 == 0){
System.out.println(bilangan);
System.out.println("Bilangan Genap");
}
else{
System.out.print(bilangan);
System.out.println("Bilangan Ganjil"); 
}
}
}

Contoh Program Java (Latihan IF B)

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package latihan.pkgif.b;

/**
 *
 * @author Administrator
 */
public class LatihanIFB {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
 int suhu = 25;
if (suhu < 20)
System.out.println("Suhu dingin.");
else if (suhu < 30 )
System.out.println("Nyaman.");
else
System.out.println("Panas.");   }
   
}