Loops – Arithmetic – Problem #15
IIT Kharagpur CS10001 / CS11001 Programming and Data Structures Lab Question Archive
Difficulty: Medium
Problem Statement
Consider the following series of numbers, 4,8,14,22,32 . . . . This series follows a specific pattern. Find out the pattern. Hence take a number ‘k’ as input and print the first k terms of the series according to the rules of the pattern. Also take another integer ‘n’ as input and print the difference between the (n+1)’th term and the n’th term of the series. You must write the logic of the pattern as well as the general formula for its n’th term as comments below your code. You can assume that n starts from 1.