在线编译器 C

#include <stdio.h> int main() { int i; scanf("%d",&i); int m=1; while (m<=i) printf("%d %d %d\n",m,m*m,m*m*m); m++; return 0; }
This code reads an integer from the user and then attempts to print the first powers (1st, 2nd, 3rd) for numbers from 1 up to that integer. However, it does not work correctly because the loop only repeats the `printf` statement, not the increment of `m`.

- The `while` loop in C only controls the single statement immediately following it unless you use braces `{}` to group multiple statements. Here, only `printf` is inside the loop, and `m++` is outside, so `m` never increases and the loop runs forever.
- To fix this, you need to ensure that both the `printf` and the `m++` are executed together in each iteration of the loop.