Black cells in a chessboard: BLACKCEL

link: https://www.codechef.com/CU1PP0007/problems/BLACKCEL

Given n (n is even), determine the number of black cells in an n×n chessboard.

Input Format
The only line of the input contains a single integer n.

Output Format
Output the number of black cells in an n×n chessboard.

Constraints
2≤n≤100
n is even
Sample Input 1
8
Sample Output 1
32

Solution:

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int num;
    cin>>num;
    cout<<(num*num)/2<<endl;
}
The content uploaded on this website is for reference purposes only. Please do it yourself first.