#include <stdio.h>
int sum(int n){
if (n==1)
return 1;
else
return n+sum(n-1);
}
int main(){
int a,result;
printf("enter a number = \n");
scanf("%d",&a);
result=sum(a);
printf("%d",result);
}
To embed this project on your website, copy the following code and paste it into your website's HTML: