i <= 24; i++) {
print(i);
}
}
I want to loop for every 4 and 8 difference number like 12 16 24 how to that ?
any one please
If i understood correctly, try this code bro: void main() { int iter = 8; for (int i = 12; i <= 24; i+=iter) { print(i); iter = iter == 4 ? 8 : 4; } }
how to do like 1 to 12 continue number and the after 12 i need 14, 16, 20, 24
If i > 12: Than
this one... void main() { int iter = 1; for (int i = 0; i <= 24; i+=iter) { if (i < 12) { print(i); continue; } if (i == 12) { iter = 8; } print(i); iter = iter == 4 ? 8 : 4; } }
Обсуждают сегодня