Programming Code Center(PCC)
[C]

(PCC)::[How-to-write-a-C-Program-to-Find-the-Sum-of-Natural-Numbers-using-Recursion]::[c]

File Name : Sum_of_Natural_Numbers_using_Recursion.c

//Sum of Natural Numbers Using Recursion
#include <stdio.h>
int addNumbers(int n);
int main() {
    int num;
    printf("Enter a positive integer: ");
    scanf("%d", &num);
    printf("Sum = %d", addNumbers(num));
    return 0;
}

int addNumbers(int n) {
    if (n != 0)
        return n + addNumbers(n - 1);
    else
        return n;
}

Output :

Sum_of_Natural_Numbers_using_Recursion.jpg