I am trying to get this output from my code:
0
10
110
1110
11110
111110
but what i get is
0
10
109
1110
11109
This is my code so far:
void optimal(int arrsize) {
int j;
int code = 0;
cout << '0' << endl;
for (int i = 1; i < arrsize; i++) {
j = i;
while (j > 0) {
code += pow(10, j);
j--;
}
cout << code << endl;
code = 0;
}
}