1. To Find Addition of Two Number In Python
num1=int(input("\n\n Enter First Number = "))
num2=int(input("\n\n Enter Second Number = "))
result=num1+num2
result=num1+num2
print("\n Addition Of Entered Number Is =",result)
2. To Check For Even & Odd Number
print("\n\n\n TO CHECK ENTER NUMBER IS EVEN OR ODD ")
num=int(input("\n Enter The Number "))
if(num%2==0):
print("\n Entered Number ",num, "Is Even ")
else:
3. To Check For Prime Number
print("\n\n\n To Check For Prime Number ")
num=int(input("\n\n Enter The Number To Be Checked = "))
if num > 1:
for i in range(2,num):
if (num % i) == 0:
print(num,"is not a prime number")
break
else:
print(num,"is a prime number")
else:
Comments
Post a Comment