Check Odd or Even

PHOTO EMBED

Sat Oct 19 2024 14:12:11 GMT+0000 (Coordinated Universal Time)

Saved by @Saging #java

package com.mycompany.chkoddeven;

import java.util.*;

public class ChkOddEven {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        System.out.print("Input a number from 1-10: ");
        int num = sc.nextInt();
        
        int evenorodd = num%2;
        if (evenorodd == 1) {
            System.out.println("The number is Odd: " + num);
        } else {
            System.out.println("The number is Even: " + num);
        }
    }
}
content_copyCOPY