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

4th Practical

Uploaded by

prasad wadkar
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)
2 views

4th Practical

Uploaded by

prasad wadkar
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/ 3

PRACTICAL NO: 4

1. WAP to check whether a number is even or odd.

Program:
num=int(input("Enter a number to check: "))
if num%2==0:
print("Even")
else:
print("Odd")

Output:

2. WAP to find out absolute value of an input number.

Program:
number=float(input("Enter a value: "))
absolute=abs(number)
print("Absolute value of ",number," is: ",absolute)

Output:

3. WAP to find out the largest number among three numbers.

Program:
a=int(input("Enter 1st number: "))
b=int(input("Enter 2nd number: "))
c=int(input("Enter 3rd number: "))
if a>b and a>c:
print(a,"is the largest number")
elif b>c and b>c:
print(b,"is the largest number")
elif c>a and c>b:
print(c,"is the largest number")
else:
print("All are equal")

Output:

4. WAP to check whether the input year is leap year or not.

Program:
year=int(input("Enter the year to be check: "))
if year%4==0:
print("Leap Year")
else:
print("Non-Leap Year")

Output:

5. WAP to check whether a number is positive, negative or zero.

Program:
number=int(input("Enter a number: "))
if number>0:
print("Entered number",number,"is Positive number.")
elif number<0:
print("Entered number",number,"is Negative number.")
else:
print("Entered number",number,"is Zero.")

Output:

6. WAP that takes the marks of 5 subjects and displays the grade.

Program:
#Max marks=100
Sub1=int(input("Enter the marks of 1st subject: "))
Sub2=int(input("Enter the marks of 2nd subject: "))
Sub3=int(input("Enter the marks of 3rd subject: "))
Sub4=int(input("Enter the marks of 4th subject: "))
Sub5=int(input("Enter the marks of 5th subject: "))
total=Sub1+Sub2+Sub3+Sub4+Sub5
percentage=(total/500)*100
if percentage>=90:
grade=("A+ (Excellent)")
elif percentage>=80:
grade=("A (Very Good)")
elif percentage>=70:
grade=("B (Good)")
elif percentage>=60:
grade=("C (Average)")
elif percentage>=40:
grade=("D (Pass)")
else:
grade=("F (Fail)")
print(grade)

Output:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy