#include <iostream>
using namespace std;
int main() {
int n = 20;
// Question 6
for (int i = 1; i <= n; i++) {
if (i % 2 == 1) cout << i * i << ' ';
}
cout << '\n';
// Question 7
for (int i = 1; i <= 20; i++) {
if (i % 3 == 0) cout << i << ' ';
}
return 0;
}
Output:
1 9 25 49 81 121 169 225 289 361
3 6 9 12 15 18
Comments
Leave a comment