DevJourney · code I wrote while learning

README.md

1.2 KB

Single File Programming Question

Problem Statement

You are tasked with developing a program for a Math competition. One of the challenges in the competition requires participants to find the sum of the squares of the first n even numbers and odd numbers.

Write a C++ program that uses an inline function to calculate the sum of the squares of the first n even and odd numbers. The program should take an input value of n from the user and output the result. You need to implement the necessary functions and ensure that the program handles the computation accurately.

Function specifications:

inline int sumOfSquaresEven - calculates the sum of squares of the first n even numbers

inline int sumOfSquaresOdd - calculates the sum of squares of the first n odd numbers

Note: This is a sample question asked in Accenture recruitment.

Input format :

The input consists of a positive integer N.

Output format :

The first line of output displays the sum of squares of the first N even numbers.

The second line of output displays the sum of squares of the first N odd numbers.

Code constraints :

1 <= N <= 30

Sample test cases :

Input 1 :

3

Output 1 :

56 35 Whitelist Set 1: inline int sumOfSquaresEven inline int sumOfSquaresOdd