fork download
  1. #include <bits/stdc++.h>
  2. void main()
  3. {ios_base::sync_with_stdio(false);
  4. cin.tie(NULL);
  5.  
  6. int t,n,i,c,j;
  7. cin>>t;
  8. for(i=0;i<=t;i++)
  9. {c=0;
  10. cin>>n;
  11. for(j=1;j<=n;j=j+2)
  12. {c=c+(n-j+1)*(n-j+1);
  13. }
  14. cout<<c<<"\n";
  15. }
  16. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
2
3
8
compilation info
prog.cpp:2:11: error: ‘::main’ must return ‘int’
 void main()
           ^
prog.cpp: In function ‘int main()’:
prog.cpp:3:2: error: ‘ios_base’ has not been declared
 {ios_base::sync_with_stdio(false);
  ^~~~~~~~
prog.cpp:4:5: error: ‘cin’ was not declared in this scope
     cin.tie(NULL);
     ^~~
prog.cpp:4:5: note: suggested alternative:
In file included from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:75:0,
                 from prog.cpp:1:
/usr/include/c++/6/iostream:60:18: note:   ‘std::cin’
   extern istream cin;  /// Linked to standard input
                  ^~~
prog.cpp:14:1: error: ‘cout’ was not declared in this scope
 cout<<c<<"\n";
 ^~~~
prog.cpp:14:1: note: suggested alternative:
In file included from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:75:0,
                 from prog.cpp:1:
/usr/include/c++/6/iostream:61:18: note:   ‘std::cout’
   extern ostream cout;  /// Linked to standard output
                  ^~~~
stdout
Standard output is empty