Java Loop Board Questions


  1. Define a class to accept a number from user and check if it is an EvenPal number or not. [15 MARKS-2024]

    (The number is said to be EvenPal number when number is palindrome number (a number is palindrome if it is equal to its reverse) and sum of its digits is an even number.)

    Example:
    121 – is a palindrome number
    Sum of the digits – 1+2+1 = 4 which is an even number
  2. coming soon

  3. A tech number has an even number of digits. If the number is split in two equal halves, then the square of sum of these halves is equal to the number itself. Write a program to generate and print all four digits tech numbers. [15 MARKS-2019]

    Example:
    Consider the number 3025
    Square of sum of the halves of 3025 = (30 + 25)2
    = (55)2
    = 3025 is a tech number.
  4. coming soon

  5. Write a program to input a number and check and print whether it is a Pronic number or not. (Pronic number is the number which is the product of two consecutive integers). [15 MARKS-2018]

    Examples:
    12 = 3 x 4
    20 = 4 x 5
    42 = 6 x 7
  6. coming soon

  7. Write a program to accept a number and check and display whether it is a spy number or not. (A number is spy if the sum of its digits equals the product of its digits.) [15 MARKS-2017]

    Example: consider the number 1124.
    Sum of the digits = 1 + 1 + 2 + 4 = 8
    Product of the digits = 1 x 1 x 2 x 4 = 8
  8. coming soon

  9. Write a program to accept a number and check and display whether it is a Niven number or not. (Niven number is that number which is divisible by its sum of digits.). [15 MARKS-2016]

    Example:
    Consider the number 126.
    Sum of its digits is 1 + 2 + 6 = 9 and 126 is divisible by 9.
  10. coming soon

  11. Write two separate programs to generate the following patterns using iteration (loop) statements: [15 MARKS-2015]

    (a)
    *
    *#
    *#*
    *#*#
    *#*#*
    
    (b)
    54321
    5432
    543
    54
    5
    
  12. coming soon

  13. A special two-digit number is such that when the sum of its digits is added to the product of its digits, the result is equal to the original two-digit number. [15 MARKS-2014]

    Example:
    Consider the number 59.
    Sum of digits = 5 + 9 = 14
    Product of digits = 5 * 9 = 45
    Sum of the sum of digits and product of digits = 14 + 45 = 59

    Write a program to accept a two-digit number. Add the sum of its digits to the product of its digits. If the value is equal to the number input, then display the message "Special two—digit number" otherwise, display the message "Not a special two-digit number".
  14. coming soon

  15. The International Standard Book Number (ISBN) is a unique numeric book identifier which is printed on every book. The ISBN is based upon a 10-digit code. [15 MARKS-2013]

    The ISBN is legal if:

    1 × digit1 + 2 × digit2 + 3 × digit3 + 4 × digit4 + 5 × digit5 + 6 × digit6 + 7 × digit7 + 8 × digit8 + 9 × digit9 + 10 × digit10 is divisible by 11.

    Example:
    For an ISBN 1401601499
    Sum = 1 × 1 + 2 × 4 + 3 × 0 + 4 × 1 + 5 × 6 + 6 × 0 + 7 × 1 + 8 × 4 + 9 × 9 + 10 × 9 = 253 which is divisible by 11.

    Write a program to:

    (i) Input the ISBN code as a 10-digit integer.

    (ii) If the ISBN is not a 10-digit integer, output the message "Illegal ISBN" and terminate the program.

    (iii) If the number is divisible by 11, output the message "Legal ISBN". If the sum is not divisible by 11, output the message "Illegal ISBN".
  16. coming soon

  17. Write a program to input a number and print whether the number is a special number or not. [15 MARKS-2011]

    (A number is said to be a special number, if the sum of the factorial of the digits of the number is the same as the original number).

    Example:
    145 is a special number, because 1! + 4! + 5! = 1 + 24 + 120 = 145.

    (Where ! stands for the factorial of the number and the factorial value of a number is the product of all integers from 1 to that number, example 5! = 1 * 2 * 3 * 4 * 5 = 120)
  18. coming soon