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

Program

The document contains four Python programs: the first checks if a number is even or odd and if it is positive or negative; the second checks if a number is a palindrome; the third finds the largest of three numbers; and the fourth converts Celsius temperature to Fahrenheit.

Uploaded by

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

Program

The document contains four Python programs: the first checks if a number is even or odd and if it is positive or negative; the second checks if a number is a palindrome; the third finds the largest of three numbers; and the fourth converts Celsius temperature to Fahrenheit.

Uploaded by

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

1) Write a python program the prompts the user for number to find the

following

i)a number is even or odd

x=int(input(“Enter x:”))

if x%2==0:

print(“x is even :”)

else:

print(“ x is odd:”)

ii)a number is positive or negative

x=int(input(“Enter x:”))

if n > 0:

print(“Positive”)

else:

print(“Negative”)

2) Write a python program to check whether the given number is

palindrome or not.

x=int(input(“Enter a number: “))

n=x

rev=0

while n>0:

rem=n%10

rev=rev*10+rem

n=n//10

print(“Reverse number is:”,rev)

if x==rev:

print(x, “is a palindrome” )

else:
print(x, “is not a palindrome “)

3) Write a python program to find largest of 3 number

a = 10

b = 14

c = 12

if (a >= b) and (a >= c):

largest = a

elif (b >= a) and (b >= c):

largest = b

else:

largest = c

print(“the largest number is “,largest)

4) Write a python program the prompts the user for Celsius temperature .convert the
temperature to Fahrenheit .print out converted temperature.

celsius = float(input(“Enter temperature in celsius:”))

fahrenheit = (celsius * 1.8) + 32

print(“the temperature in Fahrenheit” , fahrenheit )

You might also like