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.

Back to Lab Problems
Loops/Arithmetic/Problem #15

Lab Problem Statement

Specifications & Problem DetailsIIT Kharagpur PDS Archive
Loading question...

Interactive C Compiler · Problem #15

WASM In-Browser

Runs directly on your machine · Zero remote server dependency

Compiler downloads on first Run (large, saved in your browser after that)
main.cCtrl + Enter to run
1
2
3
4
5
6
7
Input (stdin)given to scanf / cin
Output

Output appears here. Press Run to compile and execute.