Heya buddies: Please answer this out: find GCD of two numbers using Python. Spammers, stay away, stay safe
Answers
Step 1:Get 2 integer inputs from the user
Step 2:Next, use decision-making statements or use recursion to check if both the given numbers are divisible by any number (i) without leaving any remainder.
Step 3:If true, then GCD = i
Step 4:Print the GCD of the two numbers
Step 5:End of the program
# Python Program to find GCD of Two Numbers using While loop
num1 = int(input("Enter 1st number: "))
num2 = int(input("Enter 2nd number: "))
i = 1
while(i <= num1 and i <= num2):
if(num1 % i == 0 and num2 % i == 0):
gcd = i
i = i + 1
print("GCD is", gcd)
Answer:
find the unit vector of vector a= cap find the unit vector of vector a= cap i+cap2j+cap 3k along vector B=cap2i+capj+capkfind the unit vector of vector a= cap i+cap2j+cap 3k along vector B=cap2i+capj+capkfind the unit vector of vector a= cap i+cap2j+cap 3k along vector find the unit vector of vector a= cap i+cap2j+cap 3k along vector B=cap2i+capj+capk