Computer Science, asked by amitpandit0391, 4 months ago

Write a program to print following series 2,6,12,20....10terms​

Answers

Answered by allysia
2

Language:

Python

Patterns:

2*1=2

2*3= 6

2*6=12

2*10=20

Program:

n=1

a=1

while n<11:

   print(2*a)

   a=n+a+1

   n=n+1

Output:

2

6

12

20

30

42

56

72

90

110

Explanation:

  • n controls the number of times the loop runs.
  • a controls the value being multiplied to 2. Every time the loop runs it increases by n+1+ older value of a.

Attachments:

Attachments:
Similar questions