Answered step by step
Verified Expert Solution
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started