Concept Flow - Why input and output are required
Start Program
Get Input from User
Process Input
Produce Output
End Program
The program starts by getting input, then processes it, and finally produces output before ending.
package main import "fmt" func main() { var name string fmt.Print("Enter your name: ") fmt.Scanln(&name) fmt.Println("Hello,", name) }
| Step | Action | Input/Variable State | Output |
|---|---|---|---|
| 1 | Program starts | name = "" | |
| 2 | Prompt user for input | name = "" | Enter your name: |
| 3 | User enters input | name = "Alice" | |
| 4 | Print greeting | name = "Alice" | Hello, Alice |
| 5 | Program ends | name = "Alice" |
| Variable | Start | After Input | Final |
|---|---|---|---|
| name | "" | "Alice" | "Alice" |
Input and output let programs interact with users. Input collects data from the user. Output shows results back to the user. Without input, programs can't get user info. Without output, users can't see results. Together, they make programs useful.