Computer Science, asked by Anonymous, 8 months ago

write a program to check whether no is even or odd in java sc Scanner ​

Answers

Answered by samiksha6176
0

Answer:

Java Exercises: Accept a number and check the number is even or...

Pictorial Presentation:

Sample Solution:

Java Code: import java.util.*; public class Exercise49 { public static void main(String[] args){ Scanner in = new Scanner(System.in); System.out.print("Input a number: "); int n = in.nextInt(); if (n % 2 == 0) { System.out.println(1); } else { System.out.println(0); } } }

Similar questions