Information
Here's an interactive sample run with the user input in RED):
You'll notice that you're printing the stride in the left column, the stride squared in the middle column, and the stride cubed in the right column. Then, you increment the stride by itself and print out the new values on the next line. Continue until the value in the left column is greater than the range that was input. Your output must match exactly.Enter two integers greater than 0: -4 9 Enter two integers greater than 0: 8 -5 Enter two integers greater than 0: 22 0 Enter two integers greater than 0: 0 123 Enter two integers greater than 0: -5 0 Enter two integers greater than 0: 1300 20 Enter two integers greater than 0: 200 13 Value Value^2 Value^3 ----------------------------- 13 169 2197 26 676 17576 39 1521 59319 52 2704 140608 65 4225 274625 78 6084 474552 91 8281 753571 104 10816 1124864 117 13689 1601613 130 16900 2197000 143 20449 2924207 156 24336 3796416 169 28561 4826809 182 33124 6028568 195 38025 7414875
Approximate number of lines of code: 12.
The name of the file should be squares3.c and the command to compile it will look like this:
When you've got it working, use this file to redirect the input into output files. For example:gcc -Werror -Wall -Wextra -ansi -pedantic squares3.c -o squares3 -O2 -Wno-unused-result
Input file: input.txtsquares3 < input.txt > myoutput.txt
Output file: output.txt You'll notice that the input numbers are not in the output, nor are any of the extra newlines.
Notes