0% found this document useful (0 votes)
3 views2 pages

Assignment 3

The document contains a series of Python code snippets that solve various programming problems. These include finding the greatest of three numbers, determining the minimum of two numbers, calculating the GCD of two numbers, checking if a triangle is right-angled, verifying if a number is an Armstrong number, and generating Fibonacci sequence terms. Each section prompts the user for input and provides the corresponding output based on the calculations.

Uploaded by

anuragnirmal205
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Assignment 3

The document contains a series of Python code snippets that solve various programming problems. These include finding the greatest of three numbers, determining the minimum of two numbers, calculating the GCD of two numbers, checking if a triangle is right-angled, verifying if a number is an Armstrong number, and generating Fibonacci sequence terms. Each section prompts the user for input and provides the corresponding output based on the calculations.

Uploaded by

anuragnirmal205
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

#question no.

1
no1=int(input("Enter no.1="))
no2=int(input("Enter no.2="))
no3=int(input("Enter no.3="))
if no1>no2 and no1>no3:
print("No1 is greatest")
elif no3>no1 and no3>no2:
print("No3 is greatest")

else : print("No2 is greatest")

print(" ")

#question no. 2
a=int(input("Enter first no.="))
b=int(input("Enter second no.="))
print("a is minimum" if a<b else "b is minimum")
print(" ")

#question no. 3
num1 = int(input("Enter first number="))
num2 = int(input("Enter second number.="))

if num2>num1:
mn = num1
else:
mn = num2
for i in range(1,mn+1):
if num1%i==0 and num2%i==0:
gcd=i
print("GCD is",gcd)

print(" ")

#question no.4
side1=int(input("side1="))
side2=int(input("side2="))
side3=int(input("side3="))
if (side1**2)+(side2**2 )== (side3**2):
print("Triangle is right angled")

elif (side2**2)+(side3**2 )== (side1**2):


print("Triangle is right angled")
elif (side3**2)+(side1**2 )== (side2**2):
print("Triangle is right angled")
else:print("triangle is not right angled")
print(" ")

#question no.5
n= int(input("Enter no.="))
sum=0
order = len(str(n))
copy_n = n
while(n>0):
digit = n%10
sum+= digit**order
n = n//10

if(sum==copy_n):
print(f"{copy_n} is an armstrong number" )
else:
print(f"{copy_n} is not an armstrong number")
print(" ")

#question no.6
num = int(input("Enter no of terms="))
a=0
b=1
print(a,end=" ")

for i in range(0,num+1):
c=a+b
print(c,end=" ")
a=b
b=c

You might also like