fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here int n,sum=0;
  6. cout<<how many numbers ?;
  7. cin>>n;
  8. int arr[n];
  9. cout<<enter <<n<< numbers;
  10. for(i=0;i<n;i++)
  11. {
  12. cin>>arr[i];
  13. sum+=arr[i];
  14. }
  15. cout<<sum is <<sum;
  16. return 0;
  17. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:6:8: error: ‘how’ was not declared in this scope
  cout<<how many numbers ?;
        ^~~
prog.cpp:7:7: error: ‘n’ was not declared in this scope
  cin>>n;
       ^
prog.cpp:9:8: error: ‘enter’ was not declared in this scope
  cout<<enter <<n<< numbers;
        ^~~~~
prog.cpp:9:20: error: ‘numbers’ was not declared in this scope
  cout<<enter <<n<< numbers;
                    ^~~~~~~
prog.cpp:10:6: error: ‘i’ was not declared in this scope
  for(i=0;i<n;i++)
      ^
prog.cpp:12:8: error: ‘arr’ was not declared in this scope
   cin>>arr[i];
        ^~~
prog.cpp:13:3: error: ‘sum’ was not declared in this scope
   sum+=arr[i];
   ^~~
prog.cpp:15:9: error: ‘sum’ was not declared in this scope
   cout<<sum is <<sum;
         ^~~
stdout
Standard output is empty