![]() |
VOOZH | about |
Write a program to print all multiples of 7 till 1000.
Output Format:
7, 14, 21, 28, 35 ..... 994
Approach: To solve the problem, follow the below idea:
The approach of this program is to run a loop starting from 7 and in each iteration add 7 to the current multiple to get the next multiple.
Step-by-step algorithm:
for loop to iterate through numbers starting from 7 and incrementing by 7 each time. Below is the implementation of the approach:
7 14 21 28 35 42 49 56 63 70 77 84 91 98 105 112 119 126 133 140 147 154 161 168 175 182 189 196 203 210 217 224 231 238 245 252 259 266 273 280 287 294 301 308 315 322 329 336 343 350 357 364 371 378...
Time Complexity: O(1000) ~ O(1)
Auxiliary space: O(1)