

Finding numbers divisible by 12 and 21Create a program that enumerates the first 100 positive numbers that can be divided both by 12 and by 21 in ascending order. Output SpecificationThe output consists of 100 lines containing the numbers. Each line, including the last one, must be terminated by a newline character. Hints and GuideThe exercise can easily be solved with one iteration. The iteration starts with the number 1 and runs until the necessary amount of output is constructed. The iteration can use two integers: one for counting the lines in the output and one for the next value under investigation. The % operator helps us find the divisors by calculating the remainder: One possible solution is available in: main.c. Possible ImprovementsIn programming contests where the execution time is crucial, a widely used technique is to store the constant output of the application (for example in an array) to avoid the delay caused by the calculation. We can apply this trick in our scenario since we need to store only 100 integer.
Acknowledgement
This work was supported by the construction EFOP3.4.316201600021. The project was supported by the European Union, cofinanced by the European Social Fund.


University of Debrecen; Faculty of Informatics; v. 03/01/2019 