cpp
#include <stdio.h>
int
main()
{
int x[50];
int i;
for(i=0; i<50; i++){
x[i] = i * 3;
}
for(i=0; i<50; i++){
printf("%d", x[i]);
if (i = 10 || 20 || 30 || 40)
printf("\n");
}
return(0);
}
OK!
Ive been trying to figure this out for 3 hours now..
I know there is something wrong with the if statement but i cant figure it out.
If there is another way to do this it would be great.
Make a program with an array of fifty integers. Use a loop to set the values of the array to the multiples of three, starting at zero. Use another loop to print the array, but with two differences. Use a conditional inside the loop to insert a newline after every tenth number, and use formatting information to line up the numbers in columns as shown:
CODE
2. 0 3 6 9 12 15 18 21 24 27
3. 30 33 36 39 42 45 48 51 54 57
4. 60 63 66 69 72 75 78 81 84 87
5. 90 93 96 99 102 105 108 111 114 117
6. 120 123 126 129 132 135 138 141 144 147