Write a program in JAVA to accept a number and check whether the given number is MitZ number or not
Answers
Answered by
1
Answer:
Explanation:
A number is said to be a magic number, if the sum of its digits are calculated till a single digit recursively by adding the sum of the digits after every addition. If the single digit comes out to be 1,then the number is a magic number.
For example-
Number= 50113
=> 5+0+1+1+3=10
=> 1+0=1
This is a Magic Number
For example-
Number= 1234
=> 1+2+3+4=10
=> 1+0=1
This is a Magic Number
Examples :
Input : 1234
Output : Magic Number
Input : 12345
Output : Not a magic Number
Similar questions
Math,
2 months ago
Physics,
2 months ago
Hindi,
2 months ago
Social Sciences,
4 months ago
Geography,
4 months ago
Math,
10 months ago
Social Sciences,
10 months ago