#include<stdio.h>
int sum(int n);
int main()
{
int n,concat;
printf("Enter an positive integer: ");
scanf("%d",&n);
concat=sum(n);
printf("Sum = %d",concat);
return 0;
}
int sum(int n)
{
if(n!=0)
return n+sum(n-1);
}
No comments:
Post a Comment