#include <stdio.h>

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

int main()
{
 printf("input Num\n");
 int input;
 scanf("%d", &input);
 
 int result = sum(input); 
 printf("%d\n", result);

 return 0;
}

 

Posted by fona