A. Write a program for the following in Python
1. to print a square of alternate numbers between range of 1 to 10
Answers
Answered by
0
Answer:
for i in range(1,11,2):
print(i*i)
Explanation:
for i in range(1,11,2):
print(i)
here, (1,11,2) means range from 1 to 10 and we write 11 because python takes one number less So, we write 11
The above program is for printing alternate numbers
If we want to print their square multiply the number by itself
shown below:
for i in range(1,11,2):
print(i*i)
Similar questions