Program Java Bilangan Genap & Ganjil

Coding :


import java.util.Scanner;
import java.io.*;

class Percabangan{
    public static void main(String[] args) throws IOException{
    int nilai;
       
    //Ganjil & Genap
    Scanner input = new Scanner(System.in);
    System.out.print("Masukan nilai nya :");
    nilai = input.nextInt();
   
    if(nilai % 2 == 0)
    {
        System.out.println("Bilangan Genap ="+nilai);
    }
    else {
        System.out.println("Bilangan Ganjil ="+nilai);
    }
  }
}

Related Posts

java 2618600974994125725

Post a Comment

2018. Powered by Blogger.

Search

Popular Posts

Labels