Learn practical skills, build real-world projects, and advance your career
Created 4 years ago
n=int(input("Enter a number"))
for i in range(1,n+1):
print(i*i)
Enter a number6
1
4
9
16
25
36
n=int(input("Enter a number"))
sum=0
for i in range(1,n+1):
b=i**2
print(b)
sum=sum+b
print("summation: ",sum)
Enter a number3
1
4
9
summation: 14
n=int(input("enter how many terms"))
a=0
b=1
count=0
while count<n:
print(a)
c=a+b
a=b
b=c
count=count+1
enter how many terms5
0
1
1
2
3
n=int(input("enter how many terms"))
a=0
b=1
sum=0
for i in range(0,n):
if i==0:
print(a)
elif i==1:
print(a)
sum=a+b
print(sum)
a=b
b=sum
enter how many terms1
0
1
n=int(input("enter how many terms"))
a=0
b=1
count=0
sum=0
while count<n:
print(a)
sum=sum+a
c=a+b
a=b
b=c
count=count+1
print("summation:",sum)
enter how many terms3
0
1
1
summation: 2