+ 1
Why compilation error?
#include <iostream> using namespace std; int main() { for(int d = 4; d > 1; d--) { d *= d; cout << d << endl; } cout << "D = " << d; }
3 Respuestas
+ 8
Another reason could be that variable d will never be less than or equal to 0 so it will run infinitely.
+ 6
You tried to output d outside the for loop..that variable only exists within the loop's scope,Declare it outside the loop then your code will work.
+ 1
Yes, it's true