View Code of Problem 18

#include <iostream>

using namespace std;

int main()
{
   int n,count=0,k=0;
   while(cin>>n){
       count=0,k=0;
       for(int i=1;i<=n;i++){
           
           count +=k;
           if(i%2==0)k++;

       }
       cout<<count<<endl;
   }


   return 0;
}

Double click to view unformatted code.


Back to problem 18