Black cells in a chessboard: BLACKCEL

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

Contributor: Priya (CSE)

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 material and content uploaded on this website are for general information and reference purposes only. Please do it by your own first. COPYING MATERIALS IS STRICTLY PROHIBITED.