Want to try solving this problem? You can submit your code online if you log in or register.
The problems in this set are designed to be more accessible to beginning coders. As a learning aid, walkthroughs discussing how to solve the problems in this set are available by clicking on this link. On completion of this problem set, students should be able to use loops (for example while and for loops) to simulate processes and analyse large data sets.
Input File: countin.txt
Output File: countout.txt
Time Limit: 1 second
Don't let the title fool you: in this problem, all your program needs to do is to count as high as ten thousand. Specifically, it must read in the integer n and list all the integers from 1 to n.
The input file will consist of a single integer, n. It is guaranteed that 1 <= n <= 10,000.
Your output file should consist of the integers from 1 to n in increasing order, separated by line breaks.
8
1 2 3 4 5 6 7 8
The score for each input file will be 100% if the correct answer is written to the output file and 0% otherwise.
Privacy
statement
© Australian Mathematics Trust 2001-2023
Page generated: 24 March 2023, 8:43pm AEDT