[Solved] Program to find sum up-to …..nth number [closed]
A simple for loop would do it: int compute(int n) { int i, sum=0; for(i=1; i<=n; i++) { int val = i*(i+1)*(i+1); sum += val; } return sum; } 7 solved Program to find sum up-to …..nth number [closed]