Terms of AP
Level EASY
Write a program to print first x terms of the series 3N + 2 which are not multiples of 4.
Input format :
Output format :
Constraints :
Sample Input 1 :
Sample Output 1 :
Sample Input 2 :
Sample Output 2 :
5 11 14 17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
num=int(input()) | |
count=1 | |
arr=[] | |
while len(arr)<num: | |
res=3*count+2 | |
if res%4!=0: | |
arr.append(res) | |
count=count+1 | |
for i in range(0,len(arr)): | |
print(arr[i],end=" ") |
Comments
Post a Comment
Please give us your valuable feedback