Computer Science, asked by Helpmemeplz, 3 months ago

Write a program to check whether a number is odd or even.
Answer in java


please answer me fast, is someone spam I will report 20answers

Answers

Answered by sumedhakumari974
2

Answer:

hope it helps

Explanation:

plz mark as brainliest

Attachments:
Answered by atrs7391
1

package Brainly_Answers.Program;

import java.util.Scanner;

public class To_Check_Number_Is_Odd_Or_Even {

   public static void main(String[] args) {

       Scanner sc =  new Scanner (System.in);

       System.out.println("Enter a number: ");

       long n = sc.nextLong();

       // taking input from user and storing it into variable n

       if (n%2==0)

       // checking if the number is even

       {

           System.out.println("Given Number is Even Number ");

           // if the number is even, then printing the message, it's even

       }

       else

        // if the number is not even, then it's obvious that number is odd

       {

           System.out.println("Given Number is Odd Number ");

           // now if number is odd then printing, number is odd

       }

   }

}

Similar questions