+ 2
What is the output of this code..
#include <iostream> using namespace std; int main() { int d=0; do { d=d+(rand()%1); d++; } while(d!=5); cout<<d; }
3 Answers
0
Either 5 or it never outputs.
0
5
0
5 obviously
#include <iostream> using namespace std; int main() { int d=0; do { d=d+(rand()%1); d++; } while(d!=5); cout<<d; }