Tugas Program/Bahasa Java mengenai IF

Silahkan dicopy

------------------------------------------------------------------------------------------------------
public class If1 {
public static void main (String yura[]) {
int anInt = 0;
if (anInt == 0)
System.out.println ("Variabel anInt bernilai Nol");
}
}

------------------------------------------------------------------------------------------------------
public class If2
{
    public static void main (String yura[])
    {
        int x = 1;

        System.out.println("Nilai x = " + x);       

        if (x == 0)
        {
        System.out.println ("Variabel x bernilai Nol");

        }else{

        if (x != 0)
        System.out.println("Variable x tidak bernilai Nol");
        }
    }
}

------------------------------------------------------------------------------------------------------
public class If3
{
    public static void main(String yura [])
    {
        int nilai = 80;

        System.out.println("Nilai = " + nilai);
        if (nilai>50)
        {
        System.out.println("Lulus");
        }else{
        if (nilai<=50)
        System.out.println("Tidak Lulus");
        }
    }
}

------------------------------------------------------------------------------------------------------


Note : Save satu per satu setiap warna merupakan satu program berarti ada 3 program.
Save dengan "
Nama : *.java
Save type as : All files

comment 0 komentar:

Posting Komentar

Delete this element to display blogger navbar

 
© Diary Technology | Design by Blog template in collaboration with Concert Tickets, and Menopause symptoms
Powered by Blogger