assign 2

3
Introduction to Computer Science Section-A Assignment-2 Submission: Monday 6 th April, 2015 till 1:30pm Submission path: \\xeon\Spring 2015\Sidra Basharat\ITC\submissions\assign-2 Exercise 1: The following pseudo code was given in your exam. Complete the pseudo code in c++ such that it draws the following figure: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10 . 11 . 12 . 13 . 14 . 15 . 16 . 17 . 18 . 19 . 20 . 21 . 22 . 23 . Set size to 5 Set z to 1 Set i to 0 While i<=size Begin Set j=size While j>i Begin Output “ Set j to j-1 End Output “*” If i>0 Begin Set k to 1 While k<=z Begin Output “ Set k to k+1 End Set z to z+2 Output “*” End Move to next line Set i to i+1 End For size=5

Upload: arxlan-xahir

Post on 16-Sep-2015

214 views

Category:

Documents


0 download

DESCRIPTION

C++

TRANSCRIPT

Introduction to Computer ScienceSection-AAssignment-2

Submission: Monday 6th April, 2015 till 1:30pmSubmission path: \\xeon\Spring 2015\Sidra Basharat\ITC\submissions\assign-2Exercise 1:

The following pseudo code was given in your exam. Complete the pseudo code in c++ such that it draws the following figure:

1.

2.

3.

4.

5.

6.

7.

8.

9.

10.

11.

12.

13.

14.

15.

16.

17.

18.

19.

20.

21.

22.

23.

24.

25.

26.

27.

Set size to 5

Set z to 1

Set i to 0

While ii

Begin

Output

Set j to j-1

End

Output *

If i>0

Begin

Set k to 1

While k