Advertisements
Advertisements
Question
Following is an algorithm to classify numbers as “Single Digit”, “Double Digit” or “Big”.
Classify_Numbers_Algo
INPUT Number
IF Number < 9
"Single Digit"
Else If Number < 99
"Double Digit"
Else
"Big"
Verify for (5, 9, 47, 99, 100, 200) and correct the algorithm if required.
Short/Brief Note
Advertisements
Solution
The correct algorithm is:
INPUT Number
IF Number < 10
"Single Digit"
Else If Number < 100
"Double Digit"
Else
"Big"shaalaa.com
Representation of Algorithms
Is there an error in this question or solution?
