fork download
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. unsigned n, i;
  6. long long s = 0;
  7.  
  8. scanf("%u", &n);
  9. for (i = 0; i < n; i++)
  10. {
  11. s += i * i;
  12. }
  13. printf("%I64d\n", s);
  14.  
  15. return 0;
  16. }
Success #stdin #stdout 0s 2252KB
stdin
20
stdout
                                                            2470