#include <iostream>
usingnamespace std;
int main () {
for (int x=1;x>9;x++) {
for (int y=1;y>9;y++) {
cout << x;
cout << " x ";
cout << y;
cout << " = ";
cout << x*y;
cout << endl;
}
}
return 0;
}
so basically this code should output the multiplication table like this:
1 2 3 4 5 6 7 8 9
1 x 1 = 1
1 x 2 = 2
1 x 3 = 3
....
2 x 1 = 2
2 x 2 = 4
2 x 3 = 6
....
9 x 9 = 81
the problem is, cout is just not outputting anything.. I don't know what's happening, never happend before, probably it's something basic I'm blind and I can't see.
I don't understand your last question. I repeat what I said before, but a little bit more in depth:
for (int x=1;x>9;x++)
the program will never enter the for loop, because the conidition is "as long as x is grater than 9". x is initialized as 1, so... it just doesn't fit the condition...
try instead:
for (int x=1;x < 9;x++) // as long as x is less than 9 --> 1 2 3 4 5 6 7 and 8 will do