# Problem

Write a program in C to find the sum of natural numbers using recursive function.

# How to find the sum of natural numbers using recursion in C ?

```#include <stdio.h>
int Sum(int n);
int main()
{
int input;
printf("Abundantcode.com Coding samples\n");
printf("Enter the limit : ");
scanf("%d", &input);
printf("Result = %d",Sum(input));
return 0;
}

int Sum(int input)
{
if(input != 0)
return input + Sum(input-1);
else
return input;
}```

### Output

Abundantcode.com Coding samples

Enter the limit : 5

Result = 15
{"ft_lang_label":"__label__en","ft_lang_prob":0.5317901,"math_prob":0.97378296,"size":595,"snap":"2021-31-2021-39","text_gpt3_token_len":155,"char_repetition_ratio":0.11675127,"word_repetition_ratio":0.086021505,"special_character_ratio":0.28067228,"punctuation_ratio":0.16528925,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99693793,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-09-21T20:15:01Z\",\"WARC-Record-ID\":\"<urn:uuid:085802d6-2ebc-449a-b5c1-4e56ca366c4e>\",\"Content-Length\":\"103340\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:4f0c169d-2339-45fc-8a23-4f7566a771ab>\",\"WARC-Concurrent-To\":\"<urn:uuid:41867374-fead-4847-b26c-52ad9032b20c>\",\"WARC-IP-Address\":\"104.21.50.173\",\"WARC-Target-URI\":\"https://abundantcode.com/c-program-to-find-the-sum-of-natural-numbers/\",\"WARC-Payload-Digest\":\"sha1:ECPYDJJZHYJA7CRVOYF52MEEGLVUBJ43\",\"WARC-Block-Digest\":\"sha1:ROO5EKF46GA2CFS3M42RHYV6WNEWLJWC\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-39/CC-MAIN-2021-39_segments_1631780057227.73_warc_CC-MAIN-20210921191451-20210921221451-00154.warc.gz\"}"}