Practical 6
Practical 6
Enter a number: 10
1
2
3
4
5
6
7
8
9
10
Enter a number: 3
In [10]: factorial = 1
i=1
while i<=n:
factorial = factorial*i
i=i+1
print(f"Factorial of {n} is {factorial}")
Factorial of 3 is 6
Enter a number: 6
In [12]: a, b = 0, 1
for _ in range(n):
print(a, end=" ")
a, b = b, a + b
0 1 1 2 3 5
The number of integers between 1 and 1000 that are divisible by 7 is: 142
In [25]: # Check if the original number is the same as the reversed number
if original_number == reversed_number:
print(f"{n} is a palindrome.")
else:
print(f"{n} is not a palindrome.")
In [ ]: