Computer Science, asked by alapsamaddar49, 9 hours ago

C. Answer the following questions-
1. Write a Java program to check weather in number is even or
odd.​

Answers

Answered by Sanskar260
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