1#include <stdio.h>
2int addNumbers(int n);
3int main() {
4 int num;
5 printf("Enter a positive integer: ");
6 scanf("%d", &num);
7 printf("Sum = %d", addNumbers(num));
8 return 0;
9}
10
11int addNumbers(int n) {
12 if (n != 0)
13 return n + addNumbers(n - 1);
14 else
15 return n;
16}
17