[M-9]Write a main() program that prints
lines for k==0 up to some limit, say k==11.
On each line print those integers from 100*k to 100*k+99 that are multiples of 23. For example, here is the output for k==0 up to k==11:
0 23 46 69 92
115 138 161 184
207 230 253 276 299
322 345 368 391
414 437 460 483
506 529 552 575 598
621 644 667 690
713 736 759 782
805 828 851 874 897
920 943 966 989
1012 1035 1058 1081
1104 1127 1150 1173 1196
This is a fairly tricky program. See if you can get it to work. Here is a skeleton:
#include <stdio.h>
#include <stdlib.h>
/* Puzzle L14 -- on each line k print all the integers in the
| range 100*k to (100*k+99) that are multiples of 23.
|
| Not a very good solution: does 23 times more work than
| is needed.
*/
int main()
{
int k; /* line number */
int base; /* The base number for line k is 100*k */
int j; /* values 0..99 to add to the base number for line k*/
/* for each line number k */
for ( )
{
base = 100*k;
/* for the 100 integers considered for line k */
for ( )
/* decide if the integer should be printed */
if ( )
printf("%7d", (base+j) );
printf("\n");
}
return 0;
}