Skip to the task
Layout
Back to classic view

You are looking ahead. Your place is still task 1: Style.

CHECKTask 17 of 23 · step 9: Drills: check yourselfWhat does it look like after Ctrl+Alt+L?
What does it look like after Ctrl+Alt+L? in practice/04/

What does this function look like after Ctrl+Alt+L? What will you still have to fix by hand?

Details & hint
int f(int x){int y;if(x>5)y=1;else y=2;return y;}

Stuck? Each statement on its own line, the if and else branches indented but without { }. The braces, and names in place of f, x, y, you add yourself.

practice 04 main.c Code Diff
UNCHANGED This step does not change this file.
#include <stdio.h>
#include "input.h"
int main(void) {
int grade = read_int("Grade (0 - stop): ");
int sum = 0;
int count = 0;
while (grade != 0) {
sum += grade;
count++;
grade = read_int("Grade (0 - stop): ");
}
if (count > 0) {
printf("Average: %.2f\n", (double)sum / count);
} else {
printf("No grades.\n");
}
return 0;
}