Count Distinct Rectangles in N * N Chessboard | Java program to count unique rectangles in a chessboard ; Function to count distinct rectangles ; Driver Code
class Rectangle { static int count ( int N ) { int a = 0 ; a = ( N * ( N + 1 ) ) / 2 ; return a ; } public static void main ( String args [ ] ) { int n = 4 ; System . out . print ( count ( n ) ) ; } }