0
Why is this code not working in Sololearn? g (1,3)
int g (int x, int n) { for (int i = 0; i < n; i++) { if (i % 2 == 0) { x *= i + 1; continue; } x--; if (x == 0) { break; } } return x; }
5 odpowiedzi
0
try this code :
int g (int x, int n) {
int y =x;
for(int i = 0;i < n; i++) {
if (i % 2 == 0){
y *= i + 1;
continue;
}
y - - ;
if (y ==0){
break ;
}
}
return y;
}
0
did not work
0
hm
can u give me error message?
0
int g (int x, int n) {
for (int i = 0; i < n; i++) {
if (i % 2 == 0) {
x *= i + 1;
continue;
}
x--;
if (x == 0) {
break;
}
}
return x;
}
I'm sure this code correct, but why isn't working on the sololearn program? Should I add something
Can you turn it on ، share it here and thank you
0
g(1,3)