[ create a new paste ] login | about

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

C++, pasted on Jun 16:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
 
using namespace std;
 
int main()
{
    int x = 90; /*cin >> x;*/
    int a[3] = {x / 3, x / 3, x / 3};
    int i = 0;
 
    while ( a[0] + a[1] + a[2] < x ) {
        ++a[i % 3];
        ++i;
    }
 
    cout << x << " = " << a[0] << " + " << a[1] << " + " << a[2];
    return 0;
}


Output:
1
90 = 30 + 30 + 30


Create a new paste based on this one


Comments: