You are on page 1of 1

num = 10

a = 0
b = 1
count = 0

while count < num:


print(a)
n = a + b
a = b
b = n
count += 1

---------------------------------------------
num = 460
sum = 0
temp = num

while temp > 0:


digit = temp % 10
sum += digit ** 3
temp //= 10

if num == sum:
print(num,"is an Armstrong number")
else:
print(num,"is not an Armstrong number")
-------------------------------------------------

x = 24
y = 42

if x > y:
smaller = y
else:
smaller = x
for i in range(1,smaller + 1):
if((x % i == 0) and (y % i == 0)):
hcf = i
print hcf
---------------------------------------------------
num = 30

for i in range(1,num+1):
if num%i == 0:
print i,
----------------------------------------------------------------
a = 8
b = a-1
while b > 0:
fact = a * b
a = fact
b = b - 1
print fact

You might also like