[ create a new paste ] login | about

Link: http://codepad.org/GdLQK4Nu    [ raw code | output | fork ]

C++, pasted on Mar 21:
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
using namespace std;
int main()
{
    int n = 3, a = 2, result = 0;
    for (int i = 1; i < n; i++)
    {
        result += a;
        a += a * 10;
    }
    cout << a << endl;
    return 0;
}


Output:
1
242


Create a new paste based on this one


Comments: