Laboratory Exercise 2

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

CONDTITIONAL STATEMENT

Objectives:

 Learn about conditional statements and how to write them


 Learn how to use logic operators in your code Instructions:

Instructions:

1. Write a program to read the age of a candidate and determine whether it is eligible for casting his/her
own vote. Go to the editor

Sample Output :

Enter your age: 21

Congratulation! You are eligible for casting your vote.

2. Write a program to find the eligibility of admission for a professional course based on the following
criteria:

Marks in Maths >=65

Marks in Phy >=55

Marks in Chem>=50

Total in all three subject >=170

Sample Output :

Input the marks obtained in Physics :65

Input the marks obtained in Chemistry :51

Input the marks obtained in Mathematics :72

-------------------------------------------------------------------------

Total Score: 188

The candidate is eligible for admission.

3. Write a program that determines a student’s grade. The program will read three types of scores (quiz,
mid-term, and final scores) and determine the grade based on the following rules:

-if the average score =90% =>grade=A

-if the average score >= 70% and <90% => grade=B

-if the average score>=50% and <70% =>grade=C

-if the average score<50% =>grade=F

Sample Output:
Enter Quiz score: 80

Enter Mid-term score: 75

Enter Final score: 90

----------------------------------------------------

Your Average score is: 81.66667

Your Grade is B

4. Write a program to accept the age of a person and categorize the person’s life stage.

Reference for Life Stage:

Infancy (Ages 0-3)

Early Childhood (Ages 3-6)

Middle Childhood (Ages 6-8)

Late Childhood (Ages 9-11)

Adolescence (Ages 12-20)

Early Adulthood (Ages 20-35)

Midlife (Ages 35-50)

Mature Adulthood (Ages 50-80)

Late Adulthood (Age 80+)

Sample Output:

Enter your age: 25

You are in Early Adulthood stage.

You might also like