Write a program to print following pattern 1,4,9,16,25.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Answer:
Using python
Explanation:
1, 4, 9, 16, 25 are square numbers so they can be written as 1², 2², 3², 4², 5²
n = 0
while True:
print(n*n)
n += 1
if(n==6):
break
So, what I have done here is, introduced a variable with 0 as it's necessary to set the circumstances as to where to stop the loop. Then comes the while loop, where we set the value of n for where to stop. Then it print n² of the particular value of the term. n +=1 adds the value with 1 until n = 6 where 6 won't be printed
Brainliest plssss