I want to calculate the formula : 1+2+3+4+............+n = n (n+1)/2. anyone will help me to find the error of the program? it just show an error result ........
Code:// Function (RECURSION) # include<stdio.h> int funct1(int n); void main() { int n,t; printf("Enter the value until which you want to sum up\n"); scanf("%n", &n); t= funct1(n); printf(" summation= %d", t ); } int funct1(int n) { if (n>0) return (n+ funct1(n-1)); }