Last Updated :
10 Apr, 2024
Output?
#include <iostream>
using namespace std;
int main()
{
int c = 5, no = 10;
do {
no /= c;
} while(c--);
cout << no << endl;
return 0;
}
(A) 1
(B) Runtime error
(C) 0
(D) Compile 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.
Share your thoughts in the comments
Please Login to comment...