Untitled Document
Untitled Document
Aim:
To check whether the number is positive or negative or zero
Algorithm:
Step 1: start
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 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 3: check the value of ‘a’ is divisible by 2 and the remainder should be zero then ‘a’
is 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 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 7: stop
PROGRAM:
print("rajeshkumar")
print("T24D147")
a=int(input("enter of age"))
if a>=18:
print("eligible of vote")
else:
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 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 7: stop
PROGRAM:
print("rajeshkumar")
print("T24D247")
print("leap year")
else:
Result:
Whether the year is leap year or not a leap year is successfully executed
Exp no:3(e)
Aim:
Algorithm:
Step 1: start
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 8: stop
PROGRAM:
print("rajeshkumar")
print("T24D147")
a=int(input("enter a mark"))
if a>=90:
print("grade a")
print("grade b")
print("grade c")
print("grade d")
else:
print("grade f")
Output :
Result:
Aim:
To write a program for body mass index (BMI)
Algorithm:
Step 1: start
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
print("T24D147")
BMI=a/b**2
if BMI<18.5 :
elif BMI>=30 :
Result:
The program for body mass index (BMI) and its results are successfully executed
Exp no : 3(g) Program to Determine the
Aim:
Algorithm:
Step 1 : start
Step 3: if the temperature is less than 0 then print the temperature is freezing
extremely hot
PROGRAM:
print("rajeskumar")
print("T24D147")
if temp>35:
print("extremely hot")
print("it,s a warm")
print("it,s a pleasant")
print("it,s a cold")
elif temp<=0:
print("it,s freezings")
OUTPUT:
Result:
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: "))
Output:
RESULT:
The program tax of income of the salary are successfully executed
Result:
Thus the salary of tax is determined
ReplyForward
ReplyForward