Write a program to Sum of numbers up to n^{th} term

#include<stdio.h> int sum(int); int main() { int n,s; printf("Enter any number: "); scanf("%d",&n); s=sum(n); printf("Sum = %d",s); return 0; } int sum(int n) { if(n!=0) return n+sum(n-1); else return n; }

**Output**

Enter any number: 5

Sum = 15