OneCompiler

Write a program that prompts the user to input an integer. The program should then print if the integer is even or old.

Write a program that prompts the user to input an integer. The program should then print if the integer is
even or old.

2 Answers

5 years ago by

Hey! could you specify the language in which you want the solution?

Here's the python code,

print("even") if int(input("enter number"))//2 == 0 else print("odd")

Check Output here

5 years ago by Divya

import java.util.Scanner;
public class Print {
static public void main(String[] args) {
int input;
Scanner sc = new Scanner(System.in);
System.out.println("Enter an Integer Number.........");
input = sc.nextInt();
if (input % 2 == 0 || input % 3 == 0) {
System.out.println(input);
}
}
}

5 years ago by Jefferson Lakashiang