Question: Software Testing This program computes x to the power of y, where x and y are integers. INPUT: The x and y values. OUTPUT: x

Software Testing

This program computes x to the power of y, where x and y are integers.

INPUT: The x and y values.

OUTPUT: x raised to the power of y is printed.

1 void pow (int x, y)

2 {

3 float z;

4 int p;

5 if (y < 0)

6 p = 0 y;

7 else p = y;

8 z = 1.0;

9 while (p != 0)

10 {

11 z = z * x;

12 p = p 1;

13 }

14 if (y < 0)

15 z = 1.0 / z;

16 System.out.print(z);

17 }

Draw a control flow graph for this program fragment. Use the node numbers given above. List the du-Path for variable x and List the du-Path for variable y.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!