C Programming Code Examples C > Recursion Code Examples C Program to find Sum of N Numbers using Recursion C Program to find Sum of N Numbers using Recursion The following C program using recursion displays the first N natural number on the terminal. The user enters the Nth number as the input, the program then displays all integral number starting from 1 up to the N. #include <stdio.h> void display(int); int main() { int j, result; printf("Enter the Nth number: "); scanf("%d", &j); display(j); return 0; } void display(int j) { static int i = 1; if (j == i) { printf("%d \n", j); return; } else { printf("%d ", i); i++; display(j); } }