60 469
Assignments Done
98,1%
Successfully Done
In April 2018

Answer to Question #3532 in Java | JSP | JSF for Y mukundareddy

Question #3532
Write a program to find the given number is an even or odd number using if else statements?
Expert's answer
import java.util.Scanner;




public class Main {




public static void main(String[] args) {




int n;

Scanner in = new Scanner(System.in);




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

n = in.nextInt();

if(n % 2 == 0)

System.out.println(n + " is even");




else

System.out.println(n + " is odd");

}




}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions