0% found this document useful (0 votes)
13 views

Computer practical

Uploaded by

Ultra Awakening
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Computer practical

Uploaded by

Ultra Awakening
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Program for year to be checked:

year=2000 #please change the value if you want to change the number that is
calculated
if(year % 4 == 0 and year % 100 != 0 or year % 400 == 0):
print("The year is a leap year!")
else:
print("The year isn't a leap year!")

Program for Prime numbers:

number = 56789 #please change the value if you want to change the number that is
calculated

flag = False
if number>1:
for i in range(2, number):
if (number % i) == 0:
flag = True
break
if flag:
print(number, "is not a prime number")
else:
print(number, "is a prime number")

Program for addition:

a = int(input("enter first number: "))


b = int(input("enter second number: "))

sum = a + b

print("sum:", sum)

For floor division:


a = int(input("enter first number: "))
b = int(input("enter second number: "))

output = b//a

print (output)

if numbers are equal or not :

a = int(input("enter first number: "))


b = int(input("enter second number: "))

if a==b:
print("The numbers are equal")
else:
print("The numbers are not equal")

You might also like