Concept Flow - Why input and output are required
Start Program
Request Input from User
Process Input
Produce Output
End Program
The program starts, asks the user for input, processes it, shows output, then ends.
#include <stdio.h> int main() { int num; printf("Enter a number: "); scanf("%d", &num); printf("You entered: %d\n", num); return 0; }
| Step | Action | Input/Variable | Output | Explanation |
|---|---|---|---|---|
| 1 | Program starts | - | - | Program begins execution |
| 2 | Request input | - | Enter a number: | Program prints a prompt and waits for user input |
| 3 | Read input | num = 7 | - | User input stored in variable num |
| 4 | Print output | num = 7 | You entered: 7 | Program displays the input back to user |
| 5 | Program ends | - | - | Program finishes execution |
| Variable | Start | After Input | Final |
|---|---|---|---|
| num | undefined | 7 | 7 |
Input and output let programs interact with users. Input collects data to work on. Output shows results back to the user. Without input, programs have no data. Without output, users see no results.