0% found this document useful (0 votes)
2 views15 pages

03-134232-002 Abdul Moiz Computer Programming Assignment 1

The document is an assignment for the Computer Programming course at Bahria University, Lahore Campus, detailing tasks for students to complete by October 23, 2023. It includes instructions for handwritten solutions, algorithms, flowcharts, and C++ programming problems, covering topics such as area calculation, number summation, and electricity billing. The assignment emphasizes original problem-solving and prohibits copying from peers.

Uploaded by

chaudarysaad6009
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)
2 views15 pages

03-134232-002 Abdul Moiz Computer Programming Assignment 1

The document is an assignment for the Computer Programming course at Bahria University, Lahore Campus, detailing tasks for students to complete by October 23, 2023. It includes instructions for handwritten solutions, algorithms, flowcharts, and C++ programming problems, covering topics such as area calculation, number summation, and electricity billing. The assignment emphasizes original problem-solving and prohibits copying from peers.

Uploaded by

chaudarysaad6009
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/ 15

Bahria University, Lahore Campus

Department of Computer Science


Assignment 01
(FALL 2023)

Course: Computer Programming Date:23rd October,2023.


Course Code: CSC-113 Max Marks: 40
Faculty’s Name: Mr. Muhammad Sauood Deadline: 23th October 2023

Name: Abdul Moiz__ Enroll No: 03-134232-002_ Section: BS-CS(1A)______

Instructions:
1) Understanding of each question is a part of the assignment.
2) It is a handwritten assignment. You need to solve it on a paper in your handwriting.
3) Take the snaps/scan of each solved question and paste it in the document under the
question in given space. You can use CAMSCANNER app for taking snaps also or use
your normal mobile camera. Please take clear images
4) Try to think of a solution of your own. If you will keep on searching solutions on Google,
it will not make your problem-solving ability strong. This assignment is to sharp your
mind a bit or making you able to solve/think of a solution for any problem.
5) Copied assignments (from each other) will be awarded with ZERO.
6) Assignment is to be submitted in soft form on LMS as well as in hard form till the
deadline mentioned above.
Enrollment Number: 03-134232-002_
Question 1 Marks: 2.5+2.5 = 05
Write an algorithm and draw a flow chart for the given problem:
Create an algorithm and a flowchart that will compute the area of circle
Hint: A=π r 2
Algorithm:

Flow Chart:

Question 2
Marks: 2.5+2.5 = 05
Write solution and draw a flow chart for the given problem:
Create an algorithm and a flowchart that will compute the sum of two
numbers. If the sum is below or equal to twenty, two numbers will be entered
again. If the sum is above 20, it will display the sum.

Algorithm:

Flow Chart:

Page 2 of 15
Enrollment Number: 03-134232-002_

Page 3 of 15
Enrollment Number: 03-134232-002_

Page 4 of 15
Enrollment Number: 03-134232-002_

Question 3 Marks: 2.5+2.5 = 05


Write solution and draw a flow chart for the given problem:
A tub contains 4½ (4.5) liters of water and a rainy day add 100ml more water into the tub. How
many total milliliters of water are in the tub after it rained?
 For this given problem try to identify what variables are given and what other variables you
can have to calculate the total amount of water in birdbath

Hint: 1 liter = 1000 milliliters


Algorithm:

Flow Chart:

Page 5 of 15
Enrollment Number: 03-134232-002_

Page 6 of 15
Enrollment Number: 03-134232-002_

Question Marks: 2*5 = 10


Write down the C++ code of the following problem statements.

Q No 4:
Write a program to check whether a given number is even or odd.

Q No 5:
Write a program to read temperature in centigrade and display a suitable message according
to temperature state below:
Temp<0 then freezing weather
Temp 0-10 then very cold weather
Temp 20-30 then Normal in Temp
Temp 30-40 then it’s Hot
Temp >=40 then it’s very hot

Page 7 of 15
Enrollment Number: 03-134232-002_

Q No 6:
Write a program to check whether a character is an alphabet, digit or special character

Page 8 of 15
Enrollment Number: 03-134232-002_

Q No 7:
Write a program to calculate and print the electricity bill of a given customer. The customer
id, name and unit consumed by the user should be taken from the keyboard and display the
total amount to pay by the customer. You can check unit price from your electricity bill
including off-peak and peak hours.

Page 9 of 15
Enrollment Number: 03-134232-002_

Question Marks: 3*5 = 15

Write down the C++ code and dry run the following problem statements.

Q No 8:
Write a program to display the cube of the number up to a given integer.
Test Data:
Input Number of terms: 5
Expected Output:
Number is: 1 and cube of the 1 is: 1
Number is: 2 and cube of the 2 is: 8
Number is: 3 and cube of the 3 is: 27
Number is: 4 and cube of the 4 is: 64
Number is: 5 and cube of the 5 is: 125

Page 10 of 15
Enrollment Number: 03-134232-002_

Page 11 of 15
Enrollment Number: 03-134232-002_
Q No 9:
Write a program to make such a pattern like a pyramid with numbers increased by 1.
Expected Output:
1
2 3
4 5 6
7 8 9 10

Page 12 of 15
Enrollment Number: 03-134232-002_

Page 13 of 15
Enrollment Number: 03-134232-002_

Page 14 of 15
Enrollment Number: 03-134232-002_
Q No 10:
Write a program to display the n terms of harmonic series and their sum.
1 + 1/2 + 1/3 + 1/4 + 1/5 … 1/n terms
Test Data:
Input the number of terms: 5
Expected Output:
1/1 + 1/2 + 1/3 + 1/4 + 1/5
Sum of Series upto 5 terms: 2.283334

Page 15 of 15

You might also like