0% found this document useful (0 votes)
12 views3 pages

Lab-2 Journal-02-21032023-112224am

The document is a lab journal for a Computer Programming course at Bahria University, Lahore Campus, detailing various programming tasks and objectives for students. It includes assignments on algorithms, pseudocode, and programming tasks related to conditions, loops, and sequences. The lab grading sheet outlines the maximum marks for each task, totaling 30 marks.

Uploaded by

sehrish.riaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views3 pages

Lab-2 Journal-02-21032023-112224am

The document is a lab journal for a Computer Programming course at Bahria University, Lahore Campus, detailing various programming tasks and objectives for students. It includes assignments on algorithms, pseudocode, and programming tasks related to conditions, loops, and sequences. The lab grading sheet outlines the maximum marks for each task, totaling 30 marks.

Uploaded by

sehrish.riaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Bahria University, Lahore Campus

Department of Computer Science


Lab Journal 02

Course : Computer Programming - Lab Date: _______________


Course Code: CSL-113 Max Marks: 30
Faculty’s Name:

Name: _____________________ Enroll No: ___________________ Class: _____________

CLO1 Demonstrate the understanding of programing language PLO2:Knowledge for Solving Computing
syntax and its usage Problems
CLO2 Apply basic programming structures for logic construction PLO3:Problem Analysis
CLO3 Translate the devised solutions into computer programs and PLO5:Modern Tool Usage
test the implementation

ASSIGNMENT OPERATOR, ARITHMETIC OPERATORS,


CONDITIONS AND REPITITION.

Objective(s):
Upon completion of this lab session, learners will be able to:
• If/Else (Conditions)
• Loop (Repetition)

Task 01:
Daraz.pk has launched a promotion for their customers who paid online payment through
credit/Debit card. According to the promotion, the purchaser will receive a discount voucher
worth 1000PKR with their monthly spending is 10,000 PKR or more than their last month
spending and their last month bill is not less than 8,000 PKR.

1. Write algorithm for above mention problem.

Task 02:

Write pseudocode for an ATM program that allows users to withdraw money from their
account. The program should prompt the user to enter their account number and PIN. If
the account number and PIN are valid, the program should display the user's current
account balance and prompt them to enter the amount they wish to withdraw. The
program should then verify that the amount to withdraw is valid (i.e., the user has enough
%

Enrollment Number: ____________________________

funds in their account). If the amount to withdraw is valid, the program should deduct the
amount from the user's account balance and display the new balance. If the amount to
withdraw is invalid, the program should display an error message and ask the user to try
again. After a successful withdrawal, the program should ask the user if they want to
perform another transaction or exit the program.

Requirements:

Use a for loop to allow the user to try again if they enter an invalid withdrawal amount.
Use if-else statements to validate the user's account number and PIN, as well as the
withdrawal amount.
The program should terminate if the user chooses to exit.

Task 3:

Write a program to display the n terms of odd natural number and their sum.

Sample data:

Input number of terms (n) = 10

Expected Output: 1, 3, 5, 7, 9, 11, 13, 15, 17 and 19

Task 4:

Write a program to generate Fibonacci sequence. This is a sequence of numbers in which


each number is the sum of the two preceding ones. The sequence starts with 0 and 1, and each
subsequent number is the sum of the two preceding ones. For example, the first ten numbers
in the Fibonacci sequence are: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34.

Task 5:

Write a program to generate Factorial sequence. The sequence starts with 1, and each
subsequent number is the product of the previous number and the next integer. For example,
the first ten numbers in the factorial sequence are: 1, 1, 2, 6, 24, 120, 720, 5040, 40320,
362880.

Task 6:

Write a program to determine whether a given number is prime or not.

Sample data:

Input number = 13

Expected Output = 13 is a prime

Page 2 of 3
%

Enrollment Number: ____________________________

Lab Grading Sheet:

Max Obtained
Task Comments (if any)
Marks Marks
1. 05

2. 05

3. 05

4. 05

5 05

6 05

Total 30 Signature

Note: Attempt all tasks and get them checked by your Lab Instructor.

Page 3 of 3

You might also like