This is what i have so far:
n=int(input("Enter a number"))
for i in range (1,n+1,):
if(i%2==0):
print(i)
So for example, if the user enters 100, the program should print the following:
4
16
36
64
100
This is what i have so far:
n=int(input("Enter a number"))
for i in range (1,n+1,):
if(i%2==0):
print(i)
So for example, if the user enters 100, the program should print the following:
4
16
36
64
100
The **
operator in python acts as a power operator. So, x-squared is basically x**2
, and x**0.5
is square root of x
.
n = int(input("Enter a number"))
for i in range(2, n**0.5+1, 2):
print(i**2)