Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App

Related Articles

C | Loops & Control Structure | Question 9

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article


#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 as the increment is post increment, so (no/0) will create a divide by 0 error. So it fails during runtime.

Quiz of this Question

My Personal Notes arrow_drop_up
Last Updated : 01 Jun, 2021
Like Article
Save Article
Similar Reads