Answer to Question #3532 in Java | JSP | JSF for Y mukundareddy
Write a program to find the given number is an even or odd number using if else statements?
1
2012-03-06T10:47:47-0500
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!
Learn more about our help with Assignments:
JavaJSPJSF
Comments
Leave a comment