COURSE CODE: CSL-113
COURSE TITLE: COMPUTER
PROGRAMMING Lab
ASSIGNMENT 1
Q1: Write a program to display the following format using while loop
----------------------------------
A B
----------------------------------
1 5
2 4
3 3
4 2
5 1
Q2: Write a program to display the following format using while loop
----------------------------------
A B
----------------------------------
1 1
2 3
3 6
4 10
5 15
Q3: Write a program to display the following format using loop
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
Q4: Write a program that inputs the salary of an employee from the user. It deducts the income tax
from the salary on the following basis
1) 20% income tax if the salary is above Rs. 30000.
Computer Programming Lab Assignment Page 1
2) 15% income tax if the salary if the salary is between Rs. 20000 and 30000.
3) 10% income tax if the salary is below Rs. 20000.
The program finally displays the salary, income tax and the net salary.
Q5: Write a program that display the following menu for parking area
M =Motorcycle
C =Car
B =Bus
The program inputs the type of vehicle and number of days to park the vehicle. It finally displays the
total charges for the parking according to the following:
Motorcycle Rs. 10 per day
Car Rs. 20 per day
Bus Rs. 30 per day
Q6: Write a program that inputs a value and type of conversion. The program should then display the
output after conversion. The program should include the following conversions:
1) 1cm = .394 inches
2) 1 Liter = .264 gallons
3) 1 kilometer = .622 miles
4) 1 kilogram = 2.2 pounds
Make sure that the program accepts only valid choices for the type of conversion.
Q7: Write a program using nested for loop to display multiplication table as follows
1 2 3 4 5
2 4 6 8 10
3 6 9 12 15
4 8 12 16 20
5 10 15 20 25
Q8: write a program that generates the following checker card by using loop.
-----------------
----------------
-----------------
----------------
-----------------
----------------
Submission Details:
This is an Individual assignment.
Computer Programming Lab Assignment Page 2
Hard copy of the assignment should be submitted on the date mentioned in the table.
Class Name Deadlines
BS(IT) 1A 23rd October
BS(IT) 1B 23rd October
Any submission after the deadline will have a 10% marks deduction for each extra day.
Plagiarism will be awarded zero marks.
I will take viva on the day of submission.
Computer Programming Lab Assignment Page 3