basics · beginner · ~15 min
Use an arithmetic expression in a return.
Implement int square(int n) returning n*n.
int square(int n) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.