Counting numbers from the loop

I am thinking if it is possible to count the numbers from a loop..?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
  #include <iostream>
#include <fstream>
#include <iomanip>

using namespace std;

int main()
{

int d=20, z=5, k=1, n=100, i, d1, z1, dt;
int sum=0, sum1;

cout<<"The first day he learned "<<z<<" words.\n";


d1=z+k*(d-k);
z1=(z+d1)*d/2;

if (z1>n)
{
    cout<<"Yes"<<endl;
}
else
{
    cout<<"No"<<endl;
}

        for (i=z; i<=n; i=i+1)

        {
            cout<<i<<" "<<endl;

        }


return 0;
}
Topic archived. No new replies allowed.