Computer Science, asked by learner15, 1 year ago

write a program in java to print "even" if a number is even using the if statement

Answers

Answered by Deepak1011dp
3
import java.util.Scanner; public class EvenOdd { public static void main(String[] args) { Scanner reader = new Scanner(System.in); System.out.print("Enter a number: "); int num = reader.nextInt(); if(num % 2 == 0) System.out.println(num + " is even"); else System.out.println(num + " is odd");
Similar questions