check whether the number is even or odd

import java.util.Scanner;
public class Odd_Even
{
    public static void main(String[] args)
    {
        int n;
        Scanner s = new Scanner(System.in);
        System.out.print("Enter the number you want to check:");
        n = s.nextInt();
        if(n % 2 == 0)
        {
            System.out.println("The given number "+n+" is Even ");
        }
        else
        {
            System.out.println("The given number "+n+" is Odd ");
}
    }
}

Comments

  1. Sir can I give me output of the program

    ReplyDelete
    Replies
    1. 44
      The given number is 44 is even
      13
      The given number is 13 is odd

      Delete
  2. sir check whether the number is even or odd ane program lo 8th line lo print ani icharu kada akkada println ani vundadha

    ReplyDelete
  3. Print ln : It adds new line after the message gets dispalyed.
    print : It does not add any new line.

    ReplyDelete

Post a Comment