![]() |
VOOZH | about |
Write a program to print all the three-digit numbers in ascending order.
:
100 101 102...till 999
Approach: Using for Loop to print all the three Digit Numbers:
Use for loop to iterate from the smallest three-digit number, that is 100 till we reach the largest three-digit number, that is 999 and, in every iteration, print the number. After reaching 999, we will have all the three-digit numbers in ascending order.
Step-by-step algorithm:
Below is the implementation of the above approach:
All three digit numbers in ascending order: 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138...
Time Complexity: O(1000) = O(1)
Auxiliary Space: O(1)