0% found this document useful (0 votes)
33 views2 pages

Lab 2: Exercise: (Section 2) Total 100 Marks

The document outlines the tasks for Lab 2 Exercise which is worth 100 total marks. It includes 4 tasks: 1) Write a program to introduce yourself (10 marks), 2) Write a program to print "C S !" in block letters bordered by asterisks (30 marks), 3) Write a program to print the first 10 even numbers in a numbered list (30 marks), 4) Write a program to calculate and display the total number of candies given the number of jars and candies per jar (30 marks).

Uploaded by

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

Lab 2: Exercise: (Section 2) Total 100 Marks

The document outlines the tasks for Lab 2 Exercise which is worth 100 total marks. It includes 4 tasks: 1) Write a program to introduce yourself (10 marks), 2) Write a program to print "C S !" in block letters bordered by asterisks (30 marks), 3) Write a program to print the first 10 even numbers in a numbered list (30 marks), 4) Write a program to calculate and display the total number of candies given the number of jars and candies per jar (30 marks).

Uploaded by

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

LAB 2: EXERCISE

(Section 2)
Total = 100 marks

Task 1: [10 marks]


Write a C++ program to introduce yourself by providing brief details, e.g your name, age,
school, and address etc. All the information should be in the form of string and must be
displayed on the screen in a presentable manner.

Task 2: [30 marks]


Write a program that prints out C S ! in large block letters inside a border of *s followed by two
blank lines then the message Computer Science is Cool Stuff. The output should look as follows:
Task 3: [30 marks]
Write a program which prints the list of first 10 even numbers in the following manner:
Number 1: 2
Number 2: 4
Number 3: 6
Number 4: 8
Number 5: 10
Number 6: 12
Number 7: 14
Number 8: 16
Number 9: 18
Number 10: 20
Note: All the numbers should not be printed as a string. You must need to print the actual
numbers. But, all the numbers should be formed in the following way:
Number 1: 2*1
Number 2: 2*2
Task 4: [30 marks]
You are given a task to compute the total number of candies in possession of a shopkeeper.
Now the situation is that candies are equally divided in different glass jars. To do this task you
must need to gather the following information form the shopkeeper first:
- Number of jars
- Number of candies per jar
After calculating the total number of candies you must display it in the form of following
message:
If you have 4 jars
and
50 candies in each jar, then
you have 200 candies in all the jars.

You might also like