Keepaskingtheusertosupplyaninputuntilthey

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: le loop and a do-while loop with the same (1) initial state, (2) looping condition, and (3) subtask will always behave equivalently. (a) True (b) False Which loop structure is a better conceptual match for the task? Keep asking the user to supply an input until they supply a valid input a) while b) do‐while c) both are equivalent 4 2/5/2014 A for loop repeats the same task, usually for a set number of iterations Quiz Time Which loop structure is a better conceptual match for the task? Multiply a number by 2 as long as it is less than 5000. for(init; test; reinit) { subtask; } a) while b) do‐while c) both are equivalent for(ii=0; ii<N; ii++) { subtask; /* This task is repeated N times */ } while x...
View Full Document

This document was uploaded on 03/21/2014.

Ask a homework question - tutors are online