<img src="https://d5nxst8fruw4z.cloudfront.net/atrk.gif?account=iA1Pi1a8Dy00ym" style="display:none" height="1" width="1" alt="" />
Dismiss
Skip Navigation

8.2: While-Loop Drill Exercises

Difficulty Level: At Grade Created by: CK-12
Turn In

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

    Notes/Highlights Having trouble? Report an issue.

    Color Highlighted Text Notes
    Please to create your own Highlights / Notes
    Show More

    Image Attributions

    Show Hide Details
    Description
    Subjects:
    Grades:
    Date Created:
    Feb 23, 2012
    Last Modified:
    Apr 13, 2016
    Files can only be attached to the latest version of section
    Please wait...
    Please wait...
    Image Detail
    Sizes: Medium | Original
     
    CK.ENG.ENG.SE.1.Engineering-Matlab.8.2
    Add Note
    Please to create your own Highlights / Notes