Computer Science, asked by saritarai9934335413, 25 days ago

simple bluej program using if else condition

Answers

Answered by devarchanc
0

Java Programming

Question:

   Write a simple Java program using if-else condition in Bluej

Explanation:

A program that checks if a number is odd or even.

import java.util.Scanner;

class oddeven {

 public static void main(String[] args)

{

    Scanner sc= new Scanner(System.in);  

     System.out.print("Enter a number- ");

     int num = sc.nextInt();

     if (num%2 == 0) {

     System.out.println("The number is even ");

   }

    else {

      System.out.println("The number is odd.");

     }

}

}

Similar questions