#include<stdio.h>
int summation(int x)
{
if(x == 0)
return 0;
else
return x + summation(x-1);
}
int main()
{
int n, sum;
printf("Enter any positive number : ");
scanf("%d", &n);
sum = summation(n);
printf("Summation is : %d\n", sum);
return 0;
}
Comments
Post a Comment