C. Answer the following questions-
1. Write a Java program to check weather in number is even or
odd.
Answers
Answered by
1
Answer:
import java.util.*;
class OddEven
{
public static void main(String args[])
{
Scanner sc= new Scanner(System.in);
System.out.println("Enter a number: ");
int n = sc.nextInt();
if(n%2==0)
System.out.println("Number is even.");
else
System.out.println("Number is odd.");
}
}
Similar questions
Hindi,
5 hours ago
Math,
5 hours ago
World Languages,
9 hours ago
Math,
9 hours ago
India Languages,
8 months ago
Computer Science,
8 months ago