Newbie here! Why i get a result on for loops?
After debugging it I get this result.
I just started learning using for loops today and it confused me.
1 2 3 4 5 6 7 8 9 10
|
number 1
number 4
number 9
number 16
number 25
number 36
number 49
number 64
number 81
number 100
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
#include <iostream>
using namespace std;
int main()
{
int a;
for (a = 1; a <= 10; a++)
{
cout << "number "<< a * a << endl;
}
}
|
a = 1 (1*1 = 1)
a = 2 (2*2 = 4)
a = 3 (3*3 = 9)
[...]
well, so what's the question?
Topic archived. No new replies allowed.