COMP2113
COMP2113_ENGG1340 Programming technologies and Computer programming II [Section 2BC] [2023]
Loading...
Searching...
No Matches
checkpoint6.4.cpp
Go to the documentation of this file.
1#include <iostream>
2#include <cmath>
3using namespace std;
4
5int main(){
6 int i;
7 cin >> i;
8 int a[15];
9 for (int j = 0; j < ((i > 15) ? 15 : i); j++){
10 a[j] = j*j;
11 }
12 for (int j = i; j < ((15 > i+5) ? i+5 : 15); j++){
13 a[j] = 0;
14 }
15 for (int j = i+5; j < 15; j++){
16 a[j] = pow(3,j);
17 }
18 for (int j = 0; j < 15; j++){
19 cout << a[j] << " ";
20 }
21}
int main()