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);
}
}
}
Post a Comment