fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int squared(int a)
  5. {
  6. return a * a;
  7. }
  8. int main()
  9. {
  10. int i = 1;
  11. int total = 0;
  12. for (i; i < 11; i++)
  13. {
  14. total += squared(i);
  15. }
  16. cout << "SumOS TOTAL\n-----------\n" << total << endl;
  17. total = 0;
  18. for (i; i < 11; i++)
  19. {
  20. total += i;
  21. cout << i << endl << "total: " << total << endl;
  22. }
  23. total = squared(total);
  24. cout << "SquaredOS TOTAL\n---------------\n" << total << endl;
  25. }
Success #stdin #stdout 0.01s 2724KB
stdin
Standard input is empty
stdout
SumOS TOTAL
-----------
385
SquaredOS TOTAL
---------------
0