Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Exercises;
- import java.util.*;
- public class OddOrEven {
- public static void main(String[] args)
- {
- Scanner input = new Scanner(System.in);
- int a = 8, b = 2, c = 3;
- int total = a%b;
- int total2 = a%c;
- System.out.print("Enter a number: "); //prompt
- total = input.nextInt(); //read # from user
- if((a%b) == 0)
- System.out.printf("Your number is even.", total);
- if((a%c) != 0)
- System.out.printf("Your number is odd.", total2);
- }//end method main
- }//end class OddOrEven
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement