C | Loops & Control Structure | Question 9
Output?
#include <stdio.h> int main() { int c = 5, no = 10; do { no /= c; } while(c--); printf ("%d\n", no); return 0; } |
chevron_right
filter_none
(A) 1
(B) Runtime Error
(C) 0
(D) Compiler Error
Answer: (B)
Explanation: There is a bug in the above program. It goes inside the do-while loop for c = 0 also. So it fails during runtime.
Recommended Posts:
- C | Loops & Control Structure | Question 19
- C | Loops & Control Structure | Question 5
- C | Loops & Control Structure | Question 6
- C | Loops & Control Structure | Question 7
- C | Loops & Control Structure | Question 20
- C | Loops & Control Structure | Question 8
- C | Loops & Control Structure | Question 10
- C | Loops & Control Structure | Question 11
- C | Loops & Control Structure | Question 12
- C | Loops & Control Structure | Question 13
- C | Loops & Control Structure | Question 15
- C | Loops & Control Structure | Question 16
- C | Loops & Control Structure | Question 17
- C | Loops & Control Structure | Question 4
- C | Loops & Control Structure | Question 21



