- Asked 2/16
- 2074 Asoj · 2 marks
- 2071 Chaitra · 2 marks
Need of control statements
Short answer
Control statements alter the sequential flow of execution: decision (if, switch), loop (for, while, do‑while), and jump (break, continue, etc.). They are needed to make decisions, repeat code, and handle different cases, without which programs could only follow a single fixed path.
Why do we need control statements in computer programs? What are control statements?
Control statements are statements that control the order in which other statements of a program are executed. By default, C runs statements one after another (sequentially). Control statements change this flow.
Types:
- Decision (selection):
if,if-else,else-ifladder,switch - Loop (iteration):
for,while,do-while - Jump:
break,continue,goto,return
We need them to:
- take decisions according to conditions (is the number even? are the marks enough to pass?);
- repeat a block of statements many times without rewriting it;
- skip or terminate parts of a program, and so solve real problems with different cases.
Without them, a program could only run in a fixed straight line.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Output of printf statements · Computer Programming, chapter 4
- Computer program and programming · Computer Programming, chapter 2
- Need of analysis and design · Computer Programming, chapter 2
- Define structure; need of structures · Computer Programming, chapter 8 · asked 2×
- Need of stdio.h header file · Computer Programming, chapter 3
- Why do we need DFT · Digital Signal Analysis and Processing, chapter 7 · asked 6×
- Why do we need FFT · Digital Signal Analysis and Processing, chapter 7 · asked 2×
- PID tuning and computer control issues · Embedded System, chapter 7
- Purpose of PID tuning; computer control benefits · Embedded System, chapter 7