n = int(input("Enter the number of Fibonacci numbers: "))
a, b = 0, 1
count = 0
print("Fibonacci series:", end=" ")
while count < n:
print(a, end=" ")
c = a + b
a = b
b = c
count += 1
print()زبان برنامه نویسی :#python
num = int(input("Enter a number: "))
reversed_num = 0
while num != 0:
remainder = num % 10
reversed_num = reversed_num * 10 + remainder
num //= 10
print("Reversed number:", reversed_num)زبان برنامه نویسی :#python
n = int(input("Enter a number: "))
m = 1
while m < n:
m *= 2
m -= 1
isMersennePrime = True
i = 2
while i * i <= m:
if m % i == 0:
isMersennePrime = False
break
i += 1
if isMersennePrime:
print(m, "is a Mersenne prime number.")
else:
print(m, "is not a Mersenne prime number.")زبان برنامه نویسی :#python
import math
a = float(input("Please enter the length of the first side: "))
b = float(input("Please enter the length of the second side: "))
c = float(input("Please enter the length of the third side: "))
# Check the triangle formation condition
if a <= 0 or b <= 0 or c <= 0 or a + b <= c or a + c <= b or b + c <= a:
print("These three numbers cannot form the sides of a triangle.")
else:
# Calculate the triangle area using the Heron's formula
s = (a + b + c) / 2 # Semi-perimeter of the triangle
area = math.sqrt(s * (s - a) * (s - b) * (s - c)) # Triangle area
print("The area of the triangle with the given sides is: ", area)
زبان برنامه نویسی :#python