fork(1) download
  1. #include <stdio.h>
  2. int sumofsquare(int x)
  3. {
  4. if(x==1)
  5. return 1;
  6. else
  7. return x*x+sumofsquare(x-1);
  8. }
  9.  
  10. int main(void) {
  11. int n;
  12. scanf("&d",&n);
  13. printf("%d\n",sumofsquare(n));
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0s 5312KB
stdin
3
stdout
-894386190