



Program that determines if a number is odd or even. Post your code here with a screen shot showing your program’s execution.






More Options ...

Categories
Tag Cloud
Blog RSS
Comments RSS
Void (Default)
Life
Earth
Wind
Water
Fire
Lightweight
9:58 pm - April 5th, 2009
Originally Posted: 8 Mar 09 12:22 PM MST
Hello, this is my code for odd or even numbers.
/**@author RyanJB, Ryan Bridglal, http://www.RyanJB.com
*University of Advancing Technology
*CSC203-D09FEB05
*Professor Estabrook-Fishinghawk
*Week 2 Even or Odd Assignment, 03-06-09
*/
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
//declares input and integers
Scanner input = new Scanner(System.in);
int getNumber;
//begins the program and accepts input
System.out.print(”Hello, this program determines\nif the number you enter is even or odd!\n\nEnter your number:”);
getNumber = input.nextInt();
//does the calculation and outputs result
if ( getNumber % 2 == 0 ) {
System.out.print(”Your # is Even!”);
}
else {
System.out.print(”Your # is Odd!”);
}
}
}
10:01 pm - April 5th, 2009
Originally Posted: 8 Mar 09 12:22 PM MST

10:03 pm - April 5th, 2009
Originally Posted: 8 Mar 09 12:22 PM MST