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

Assignment # 3

1st 3 Questions are Lab Task and Perform in Lab

IF ELSE STATEMENT

The if/else statement executes a block of code if a specified condition is


true. If the condition is false, another block of code (else) can be
executed.
Here are the few programs using If/else statement.

Q1. Write a simple program using if else statement to find the positive
and negative number.

Q2. Write a program and the ask the age from the user and identify using
if else statement that if age is greater than 18 or less than 30 then print
You are eligible for this job if not then print you are not eligible for this
job.

Q3. Write a program to find largest number out of 3 given numbers.

Q4. Write a simple program to calculate the gpa of students. If the gpa is
greater than 3.95 then 100% scholarship, if gpa is greater than 3.90 or
less than 3.95 then the scholarship is 75%, if gpa is greater than 3.50 or
less than 3.90 than the scholarship is 50%, if gpa is greater than 3.25 gpa
is less than 3.50 then the scholarship is 25% and if gpa is less than 3.00
then you got 0% scholarship.
Q5. Write a program to find smallest number out of 5 given numbers.

Q6. Write a program to find factorial of number if user enter odd number
and find cube of number if user enter even number.

Deadline: 19/12/2021

You might also like