CS106- Lab3
CS106- Lab3
03
Control/Decision Structure
Objectives
In this lab you will be introduce with:
General If/Else statement
Nested If/Else Statement
Instructions
This is individual Lab work/task.
Complete this lab work within lab timing.
Discussion with peers is not allowed.
You can consult any book, notes & Internet.
Copy paste from Internet will give you negative marks.
Lab work is divided into small tasks, complete all tasks sequentially.
Show solution of each lab task to your Lab Instructor.
Paste your solution (i.e. code) in given space under each task.
Also make a zip/rar archive of all lab tasks and upload this file at LMS before leaving
lab.
CS 106 –Introduction to Programming
2
CS 106 –Introduction to Programming
Task 1:
Write a program that take input of three integer‘s numbers from user. Find the largest number
among three of them.
3
CS 106 –Introduction to Programming
Task 2:
Write a program using if/else operator with nested statements to find the grade of student.
The detail is as follow.
Grade>= 90 ------Grade A grade >= 80 ------Grade B grade >=70 --------Grade C grade >=60
-------Grade D
Paste screen shot of Out Put of task2 here
4
CS 106 –Introduction to Programming
Task 3:
Write a program to input a single character and print a message―It is
Vowel. If it is vowel otherwise print message. It is a "consonant―Use if-else structure and OR
(||) operator only.
5
CS 106 –Introduction to Programming
Task 4:
Write a Program that take an Integer Value from the user and tell that the number is EVEN or
ODD.
Paste code and screenshot of task here
6
CS 106 –Introduction to Programming
Task 5:
Write a program that take a single character from the user, and tells it's a Small Letter or it's a
CAPITAL letter using nested if statement only.
Paste code and screenshot of task here
7
CS 106 –Introduction to Programming
Task 6:
Make a program that tells the form of Water whether it is Ice, Water or Steam. Display the menu
also asunder.
Temperature Less than 0 =ICE
Temperature Greater than 0 & Less than 100 = Water Temperature Greater than 100 =STEAM
8
CS 106 –Introduction to Programming
EXTRA TASKS
Task 1:
write code that bid for a car .You are required to print the details of car (10 Marks)
car name
car color
car model
Requirements are following:
The amount of first bid must be more than 200000. If user enters first bid amount less
than 200000 ask him/her to re-bid
You must make 4 iteration of bids and amount of every next bid will be incremental
of 18% of previous bid
If amount of every next bid is less than previous bid it’s mean you are doing
something wrong system should not accept that bid.