3. There was a Three
by CodeChum Admin
I'm bored with just basic counting. How about we do some complex things this time? But I don't want to be associated with any number that's not divisible by 3.
Think you can handle this?
Instructions:
Print out all numbers from 1 to 100 that is divisible by 3, each in separate lines, using a for loop.
Output
Multiple lines containing an integer that is divisible by 3.
3
6
9
12
15
18
21
24
27
30
33
36
39
42
45
48
51
54
57
60
63
66
69
72
75
78
81
84
87
90
93
96
99
#include <iostream>
using namespace std;
int main()
{
for (int i = 1; i < 101; i++) {
if (i%3==0) cout << i << '\n';
}
return 0;
}
Comments
Leave a comment