write a program in python to print a square of alternate numbers between the range of 1 to 10
Answers
Answered by
3
Language:
Python
NOTE: I'm printing square of every 2nd number (alternating numbers) only.
Program:
for i in range(1,11,2):
print (i * * 2)
Output:
1
9
25
49
81
Explanation:
- range (1, 11, 2) will run a loop from 1 to 10 with a gap of 2.
- i * * 2 will return the sqauare of numbers.
Similar questions