<meta http-equiv="refresh" content="1; url=/nojavascript/"> While-Loop Drill Exercises | CK-12 Foundation
Dismiss
Skip Navigation
You are reading an older version of this FlexBook® textbook: Engineering: An Introduction to Solving Engineering Problems with Matlab Go to the latest version.

Exercise 1

How many times will this loop print 'Hello World'?

n = 10;
while n > 0
disp('Hello World')
n = n - 1;
end

Exercise 2

How many times will this loop print 'Hello World'?

n = 1;
while n > 0
disp('Hello World')
n = n + 1;
end

Exercise 3

What values will the following code print?

a = 1
while a < 100
a = a * 2
end

Exercise 4

What values will the following code print?

a = 1;
n = 1;
while a < 100
a = a * n
n = n + 1;
end

Image Attributions

Description

Categories:

Grades:

Date Created:

Feb 23, 2012

Last Modified:

Sep 15, 2014
Files can only be attached to the latest version of None

Reviews

Please wait...
Please wait...
Image Detail
Sizes: Medium | Original
 
CK.ENG.ENG.SE.1.Engineering-Matlab.8.2
ShareThis Copy and Paste

Original text