fork download
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. { int sum=0,n,i=2;
  5. cin>>n;
  6. while(i<=n)
  7. { sum =sum+i;
  8. i=i+2;
  9. }
  10. cout<<sum;
  11. }
Success #stdin #stdout 0.01s 5504KB
stdin
10
stdout
30