fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int sum_nat_number (int n)
  6. {
  7. int result;
  8. for (int i = 1; i < n-1; i++)
  9. {
  10. result += i;
  11. }
  12. return result;
  13. }
  14. return 0;
  15. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:6:1: error: a function-definition is not allowed here before ‘{’ token
 {
 ^
prog.cpp:15:1: error: expected ‘}’ at end of input
 }
 ^
stdout
Standard output is empty