What is a 'magic number' in computer programming languages.
Explain along with an example of such number.
Answers
Answered by
1
A number is said to be a magic number if the sum of digit is obtained by recursively adding the sum of its digits. If the signal digit come to be one then the number is a magical number.
Example - 199 is a magic number as 1+9+9=19 but 19 is not a single digit number so 1+9=10 and then 1+0=1 which is the signal digit number and also 1 . Hence it is a magical number.
Example - 199 is a magic number as 1+9+9=19 but 19 is not a single digit number so 1+9=10 and then 1+0=1 which is the signal digit number and also 1 . Hence it is a magical number.
nancyyy:
I'm sorry..But No more unnecessary comments out here! thanks^^"
Answered by
0
Magic numbers are special value of certain variables which causes the program to behave in an special manner. For example, a communication library might take a Timeout parameter and it can define the magic number "-1" for indicating infinite timeout.
Similar questions