#include <stdio.h> #include <string.h> #include <math.h> #define N 100 int qh(int n) { if(n==1) return 1; else return n+qh(n-1); } int main() { int n; while(scanf("%d",&n)!=EOF) printf("%d\n",qh(n)); } |
Double click to view unformatted code.