M6_Ganji genap.png
program ganjil genap java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Matkul; /** * * @author kumal */ public class M6_GanjilGenap { public static void main(String[] args) { java.util.Scanner input = new java.util.Scanner(System.in); System.out.print("Masukkan Angka : "); int n = input.nextInt(); if (n%2==1 || n%2==-1) { System.out.println("Ganjil"); } else { System.out.println("Genap"); } } }