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

CS106- Lab3

This document outlines Lab No. 03 for a programming course, focusing on control and decision structures, specifically if/else statements and nested if/else statements. It includes objectives, instructions for individual tasks, and six programming tasks that require students to implement various conditional logic scenarios. Additionally, there is an extra task related to bidding for a car with specific requirements.

Uploaded by

h8327917
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

CS106- Lab3

This document outlines Lab No. 03 for a programming course, focusing on control and decision structures, specifically if/else statements and nested if/else statements. It includes objectives, instructions for individual tasks, and six programming tasks that require students to implement various conditional logic scenarios. Additionally, there is an extra task related to bidding for a car with specific requirements.

Uploaded by

h8327917
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Lab No.

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

General for of an if statement:


if(BooleanExpression)
statement;
if(BooleanExpression) {
statement1;
statement2;
...
}

General form of an if-else statement:


If BooleanExpression :
statement or block 1
else :
statement or block 2

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.

Paste screen shot of Out Put of Program here

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.

Paste code and screenshot of task 3 here

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

Paste code and screenshot of task here

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.

Paste code and screenshot of code here

You might also like