Skip to content
Related Articles

Related Articles

C | Loops & Control Structure | Question 9
  • Difficulty Level : Basic
  • Last Updated : 06 Feb, 2013


#include <stdio.h>
int main()
    int c = 5, no = 10;
    do {
        no /= c;
    } while(c--);
    printf ("%d\n", no);
    return 0;

(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.

Attention reader! Don’t stop learning now. Get hold of all the important C++ Foundation and STL concepts with the C++ Foundation and STL courses at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :