Advertisement
JeffGrigg

TestNumber

Sep 16th, 2019
872
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 1.47 KB | None | 0 0
  1. package p20190916;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class TestNumber {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.         System.out.println("Enter the value of a");
  9.         int a = scanner.nextInt();
  10.         System.out.println("Enter the value of b");
  11.         int b = scanner.nextInt();
  12.         System.out.println("Enter the value of c");
  13.         int c = scanner.nextInt();
  14.         System.out.println("Enter the value of d");
  15.         int d = scanner.nextInt();
  16.  
  17.         boolean even = NumberFinder.isEven(a);
  18.         boolean palendrome = NumberFinder.isPalindrome(b);
  19.         boolean armstrong = NumberFinder.isArmstrong(c);
  20.         boolean strong = NumberFinder.isStrong(d);
  21.  
  22.         if (even) {
  23.             System.out.println("the number is even\n" + a);
  24.         } else {
  25.             System.out.println("the number is odd\n" + a);
  26.         }
  27.  
  28.         if (palendrome) {
  29.             System.out.println("the number is palendrome\n" + b);
  30.         } else {
  31.             System.out.println("the number is not palendrome\n" + b);
  32.         }
  33.  
  34.         if (armstrong) {
  35.             System.out.println("the number is armstrong\n" + c);
  36.         } else {
  37.             System.out.println("the number is not armstrong\n" + c);
  38.         }
  39.  
  40.         if (strong) {
  41.             System.out.println("the number is strong\n" + d);
  42.         } else {
  43.             System.out.println("the number is not strong\n" + d);
  44.         }
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement