Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following program fragments. For each program fragment, draw a flow graph, identify the independent paths, and, for each path, give examples of inputs

Consider the following program fragments. For each program fragment, draw a flow graph, identify the independent paths, and, for each path, give examples of inputs that would cause the path to be executed.

(a) z= readNumber(); y =readNumber();

x = 1;

j = 1;

while (y>= j) {

j = j + 1;

x = x * z;

}

writeNumber(x);

(b) x = readNumber();

y = readNumber();

while (x != y) {

if (x > y) {

x = x -y; }

else

{ y = y -x;}

}

writeNumber(x);

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Carry out an interview and review its success.

Answered: 1 week ago