#17330: c++遞迴解法


d10730416@gapps.fg.tp.edu.tw (Wendy Charng)


#include <iostream>
using namespace std;

int n, A(int);

int main() {
  while (cin >> n){
    cout << A(n) << endl;
  }
}

int A(int n){
  if (n == 1) return 1;
  else return A(n - 1) + n - 1;
}