Question

3. Program P2 CFG. a) Identify the basic blocks for the following program P2 written in...

3. Program P2 CFG.

a) Identify the basic blocks for the following program P2 written in

pseudo-code.

b) Draw the control flow graph.

Program P2

1) integer A, B;

2) input (A);

3) B = 1;

4) while (int i=1; i<=A; i++)

5) {

6) B = B * i;

7) if (B>13)

8) B = B / 2;

9) else

10) B = B * 2;

11) }

12) output (A,B);

13) end;

4. Program P3 CFG.

a) Identify the basic blocks for the following program P3 written in

pseudo-code.

b) Draw the control flow graph.

Program P3

1) integer A, B;

2) input (A);

3) if (A > 7)

4) {

5) B = 1;

6) } // end if A>7

7) else

8) {

9) B = 2;

10) if (A < 2)

11) B = 3;

12) } // end else A≤7

13) while (int i=1; i<=A; i++)

14) {

15) if (A<4)

16) B = B + 4;

17) else

18) B = B - 5;

19) } // end for loop

20) output (A,B);

21) end;

0 0
Add a comment Improve this question Transcribed image text
Answer #1

plz give a thumbs up  if you like the answer

Add a comment
Know the answer?
Add Answer to:
3. Program P2 CFG. a) Identify the basic blocks for the following program P2 written in...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT