C programming · Lesson
Learn to choose inputs that genuinely test an algorithm instead of running it once with an easy value.
A good test set contains at least one normal case, values exactly on the boundaries, and values immediately before and after the boundaries. Boundary cases reveal errors that random input may miss.
specification 0..100, threshold 60 → try -1 | 0 | 59 | 60 | 75 | 100 | 101 → predict → run → compare
Use Start and Step: when the active block changes, ConceptStep also highlights the C lines representing that same step.
Run C executes only the example shown on the left, using stdin on the right. The coding challenge below has a separate editor and test button.
1#include <stdio.h>
2
3int main(void)
4{
5 int voto;
6 scanf("%d", &voto);
7
8 if (voto < 0)
9 printf("FUORI\n");
10 else if (voto > 100)
11 printf("FUORI\n");
12 else if (voto >= 60)
13 printf("SUFFICIENTE\n");
14 else
15 printf("INSUFFICIENTE\n");
16
17 return 0;
18}
Read an integer score. Print INVALIDO outside 0..100; otherwise SUFFICIENTE if >=60 or INSUFFICIENTE.
This is a different program from lab 1. Complete the starter code: Check all test cases compiles this editor and tests every input, including boundary cases.
Which pair is most useful for checking that the passing threshold is implemented correctly?
Challenge 1 / 5 · Understanding
Progress: 0 / 5 · correct: 0
ConceptStep separates what is required from what is recommended or useful as reinforcement. Only required prerequisites block your progress.
Relationships: solid line = required · dashed line = recommended · dotted line = reinforcement.