Code
Reformat Code
Open practice/04/main.c and press Ctrl+Alt+L.
On the right you see what changed:
- every statement on its own line, with a 4-space indent;
- spaces around
=,!=,+, after commas and before{; - the
ifandelsebranches on separate lines, indented; - the
#includelines sorted: within one block"input.h"ends up before<stdio.h>, because"comes before<in the character order.
The program works exactly the same: formatting changes only spaces and lines. Run it with 8, 9, 10, 0: still Average: 6.75.
But now the structure shows: reading, a while loop, an if/else. And what didn't Reformat Code change? The names are still a, s, n, and the if branches have no { }. You fix that after finding the bug.
Commit: Reformat code.