0% found this document useful (0 votes)
11 views21 pages

Untitled Document

The document outlines various Python programs aimed at checking numerical properties (positive/negative/zero, odd/even), voting eligibility, leap year determination, grading system, body mass index calculation, temperature classification, and salary tax calculation. Each program includes an aim, algorithm, and code implementation with expected outputs. The results indicate successful execution for each program.

Uploaded by

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

Untitled Document

The document outlines various Python programs aimed at checking numerical properties (positive/negative/zero, odd/even), voting eligibility, leap year determination, grading system, body mass index calculation, temperature classification, and salary tax calculation. Each program includes an aim, algorithm, and code implementation with expected outputs. The results indicate successful execution for each program.

Uploaded by

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

xp no:3(a)

Program to Check whether the number is


Date:20/09/2024
positive or negative or zero

Aim:
To check whether the number is positive or negative or zero

Algorithm:
Step 1: start

Step 2: Get the value of a as input

Step 3: check the value of ‘a’ is greater than zero then ‘a’ is positive

Step 4: check the value of ‘a’ is less than zero then ‘a’ is negative

Step 5: check the value of ‘a’ is equal to zero then ‘a’ is zero

Step 6: print whether ‘a’ is positive or negative or zero

Step 7: stop

PROGRAM:
print("rajeshkumar s")

print("T24D147")

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

if a>0:

print("positive")

elif a<0:

print("negative")

else:

print("zero")
OUTPUT:

Result:
The value of a is positive or negative or zero is successfully executed
Exp no:3(b)
Program to Check whether the number is
Date:20/09/2024 ODD OR EVEN

Aim:
To check whether the number is odd or even

Algorithm:
Step 1: start

Step 2: Get the value of a as input

Step 3: check the value of ‘a’ is divisible by 2 and the remainder should be zero then ‘a’
is even

Step 4: if ‘a’ is not divisible by 2 then of ‘a’ is odd

Step 5: print ‘a’ is odd or even

Step 6: stop

PROGRAM:

print("rajeshkumar")

print("T24D147")

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

if a%2 ==0 :

print("number even")

else:

print("number odd")
Output :

Result:
The value of ‘a’ odd or even is successfully executed
Exp no:3(c)
Program to Check the eligibility of a person
Date:20/09/2024
For vote

Aim:
To check the eligibility of a person for vote

Algorithm:
Step 1: start

Step 2: Get the value of ‘a’ as the age of the person

Step 3: check whether the value of ‘a’ is greater than or equal to 18

Step 4: if ‘a’ is greater than or equal to 18 then the person is eligible for vote

Step 5: if ‘a’ is less than 18 then the person is not eligible for vote

Step 6: print the person is eligible or not for vote

Step 7: stop

PROGRAM:
print("rajeshkumar")

print("T24D147")

a=int(input("enter of age"))

if a>=18:

print("eligible of vote")

else:

print("not eligible of vote")


Output :

Result:
Whether the person is eligible or not for vote is successfully executed
Exp no:3(d)
Program to Check the whether the year
Date:20/09/2024
Is leap year

Aim:
To check whether the year is leap year

Algorithm:
Step 1: start

Step 2: Get the value of ‘a’ as year

Step 3: check whether the value of ‘a’ is divisible by 4 and not divisible by 100 then the
year is leap year

Step 4: if ‘a’ is divisible by 100 then ‘a’ is also divisible by 400 then the year is leap year

Step 5: otherwise the year is not a leap year

Step 6: print the year is leap year or not a leap year

Step 7: stop

PROGRAM:
print("rajeshkumar")

print("T24D247")

year=int(input("enter the year"))

if year %4==0 and year % 100 ==0:

print("leap year")

elif year %100==0 and year %400==0:

print("leap year ")

else:

print("not leap year")


OUTPUT:

Result:

Whether the year is leap year or not a leap year is successfully executed
Exp no:3(e)

Program for Grading system


Date:20/09/2024

Aim:

To write a program for Grading system

Algorithm:

Step 1: start

Step 2: Get the value of ‘a’ as mark

Step 3: if the value of a is greater than or equal to 90 and then assign grade A

Step 4: if the value of a is greater than or equal to 80 and less than 90 and then assign
grade B

Step 5: if the value of a is greater than or equal to 70 and less than 80 and then assign
grade C

Step 6: if the value of a is greater than or equal to 60 and less than 70 and then assign
grade D

Step 7: if the value of a is less than 60 and then assign fail

Step 8: stop
PROGRAM:

print("rajeshkumar")

print("T24D147")

a=int(input("enter a mark"))

if a>=90:

print("grade a")

elif a>=80 and a<=89:

print("grade b")

elif a>=70 and a<=79:

print("grade c")

elif a>=60 and a<=69:

print("grade d")

else:

print("grade f")
Output :

Result:

The program for grading system is successfully executed


Exp no:3(f)
Program for body mass index (BMI) and

Date:20/09/2024 The results

Aim:
To write a program for body mass index (BMI)

Algorithm:
Step 1: start

Step 2:get the value of ‘a’ as the weight of a person

Step 3: get the value of ‘b’ as the height of the person

Step 4: calculate BMI using the formula BMI =weight / height**2

Step 5:if the BMI value is less than 18.5 then assign underweight

Step 6: if the BMI value is less than 24.9 and greater than or equal to 18.5 then assign
normal weight

Step 7: if the BMI value is greater than or equal to 25 and less than 29.9 then assign
overweight

Step 8:if the BMI value i8s greater than or equal to 30 assign obesity

Step 9: print the BMI value and the results

Step 10: stop


PROGRAM:
print("rajeshkumar")

print("T24D147")

a=float(input("Enter your weight (kg):"))

b=float(input("Enter your height (m):"))

BMI=a/b**2

print ("Your BMI is :",BMI)

if BMI<18.5 :

print("You are underweight")

elif BMI>=18.5 and BMI<24.9 :

print("you are normal weight")

elif BMI>=25 and BMI<29.9 :

print ("You are overweight")

elif BMI>=30 :

print ("you are obesity")


Output :

Result:
The program for body mass index (BMI) and its results are successfully executed
Exp no : 3(g) Program to Determine the

Date : 20/09/2024 temperature

Aim:

write a program for determine the temperature by using python

Algorithm:

Step 1 : start

Step 2 : get the value of ‘a’ as temperature

Step 3: if the temperature is less than 0 then print the temperature is freezing

Step 4:if temperature is greater than 0 and less than or equal to 15

Then print the temperature is cold

Step 5:if temperature is greater than 15 and less than or equal to 25

Then print the temperature is pleasant

Step 6: if temperature is greater than 25 and less than or equal to 35

Then print the temperature is warm

Step 7: if temperature is greater than or equal to 35 then print the temperature is

extremely hot

Step 8:print the temperature


Step 9:stop

PROGRAM:

print("rajeskumar")

print("T24D147")

temp=int(input("enter a temperature "))

if temp>35:

print("extremely hot")

elif temp>25 and temp <=30:

print("it,s a warm")

elif temp>15 and temp <=25:

print("it,s a pleasant")

elif temp>0 and temp <=15:

print("it,s a cold")

elif temp<=0:

print("it,s freezings")
OUTPUT:

Result:

The program for determination of temperature is successfully executed


Exp no : 3 h) determine the tax of the salary using python
Date 20 /9/2024

Aim :
To determine the tax of the salary

Algorithm :
Step :1 start
Step :2 get their salary and store the input as floating point number in the variable income
Step : 3 if the income is less than or equal to 10000 print “no tax”
Step :4 if income is less than or equal to 50000 and calculate tax is (income-100)*0.1
Print “tax”
Step : 5 if income is less than or equal to 100000 and calculate
the tax as (50000-10000)0.1+ (income -50000)*0.2and print the calculated “tax”
Step : 6 else calculate the tax as (50000-10000)*0.1+ (100000-50000)*0.2+ income - 100000)*0.3
And print the calculate tax value

Program:
print("rajeshkumar")
print("T24D147")
income = float(input("Enter your salary: "))

if income <= 10000:


print("No tax")
elif income <= 50000:
tax = (income - 10000) * 0.1
print("Tax: ",tax)
elif income <= 100000:
tax = (50000 - 10000) * 0.1 + (income - 50000) * 0.2
print("Tax: ",tax)
else:
tax = (50000 - 10000) * 0.1 + (100000 - 50000) * 0.2 +
(income - 100000) * 0.3
print("Tax: ",tax)

Output:
RESULT:
The program tax of income of the salary are successfully executed
Result:
Thus the salary of tax is determined

ReplyForward
ReplyForward

You might also like