Computer Science, asked by Harsh82400, 9 months ago

write a program in Java to accept a number and check whether it is a 2 digit.If it is 2 digit number then print the number in words, otherwise print a message wrong input.(Bluej:class9)

Answers

Answered by Anonymous
0

Answer:

In this lesson, we will look at a Java program which checks if a 2-digit number is a special number or not. This question came in 2014 board exam. Here is the question as it came in the exam:

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.

Example:

Consider the number 59.

Sum of digits = 5 + 9 = 14

Product of its digits = 5 x 9 = 45

Sum of 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, output the message “Special 2-digit number” otherwise, output the message “Not a special 2-digit number”.

Similar questions