Exercise CheckOddEven (if-else) ~ Programming is Fun
 Programming is Fun!

www.anandsingh.net
Subscribe For Free Updates!

We'll not spam mate! We promise.

Saturday, September 6, 2014

Exercise CheckOddEven (if-else)

Write a program called CheckOddEven which prints "Odd Number" if the int variable “number” is odd, or “Even Number” otherwise.
Hints: n is an even number if (n % 2) is 0.
public class CheckOddEven {   // saved as "CheckOddEven.java"
   public static void main(String[] args) {
      int number = 49;       // set the value of number here!
      System.out.println("The number is " + number);
      if ( ...... ) {
         System.out.println( ...... );
      } else {
         System.out.println( ...... );
      }
   }
}
Comment your Answers :)


Please Give Us Your 1 Minute In Sharing This Post!
SOCIALIZE IT →
FOLLOW US →
SHARE IT →

0 comments:

Post a Comment