Wednesday, April 20, 2022

Coding Challenge Part 2

 

Python program to find l.c.m. of two numbers


num1 = int(input("Enter first number: "))  
num2 = int(input("Enter second number: "))  
if num1 > num2:  
    greater = num1  
else:  
    greater = num2  
while(True):  
    if((greater % num1 == 0) and (greater % num2 == 0)):  
        lcm = greater  
        break  
    greater += 1  
print("LCM of",num1,"and",num2,"=",greater)

Python program to calculate the cube of a number



num=int(input("Enter the number:-"))
import math
cube_n=num*num*num
print("cube  OF {} is {} ".format(num,cube_n) )

Python program to calculate the square root of a number


num=int(input("Enter the number:-"))
if num<0:
    print("Negative numbers can't have square roots")
else:
    import math
    sqrt_n=math.sqrt(num)
    print("SQRT OF {} is {} ".format(num,sqrt_n) )


Python program to find the smallest number among

 three


num1=int(input("Enter the numbers"))
num2=int(input("Enter the numbers"))
num3=int(input("Enter the numbers"))

if num1<=num2 and num1<=num3:
    print("THe smallest number is",num1)
if num2<=num1 and num2<=num3:
    print("THe smallest number is",num2)
if num3<=num1 and num3<=num1:
    print("THe smallest number is",num3)


Python program to check given number is even or odd


num=int(input("Enter the number:"))
if num%2==0:
    print("EVEN NUMBERS",num)
else:
    print("ODD NUMBERS",num)




No comments:

Post a Comment

"🚀 Delta Lake's Vectorized Delete: The Secret to 10x Faster Data Operations!"

"🚀 Delta Lake's Vectorized Delete: The Secret to 10x Faster Data Operations!" Big news for data engineers! Delta Lake 2.0+ in...