+ 2
Write a java program to input a number and display it is even or odd.
4 ответов
+ 5
Vidhi Seth once try it by yourself. If you face any problem then we will help you.
All the best.. 👍
+ 2
import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int input = Integer.valueOf(scan.nextLine());
if (input % 2 == 0)
System.out.println("Even");
else
System.out.println("Odd");
}
}
+ 1
i tried nd i hve done it. thnk u so much. Sanjeevini Kranthi
+ 1
Can anyone please explain the meaning of line after Scanner (System.in); ?