Opening the book…
Exercise \(\PageIndex{1}\)
Write the code to examine the value of the variable X. If it’s less than zero, the message negative value should be printed.
Exercise \(\PageIndex{2}\)
Write the code to examine the value of the variable X. If it’s equal to zero, the message zero value should be printed.
Exercise \(\PageIndex{3}\)
Write the code to compare the values of the variables X and Y. The greater value should be printed.
Exercise \(\PageIndex{4}\)
Write the code to examine the values of the variables X and Y. If both X and Y are greater than zero, increment X by one.
Exercise \(\PageIndex{5}\)
Write the code necessary to print the message Error! six times but without using six sequential printf() calls.
Exercise \(\PageIndex{6}\)
Write the code required to control a loop so that it continues so long as the variable K is less than 50.
Exercise \(\PageIndex{7}\)
Write the code needed to cycle the variable R from 100 to 200 in steps of 5 (i.e., 100, 105, 110, etc.).
Exercise \(\PageIndex{8}\)
Explain the practical difference between a while loop and a do-while loop.
This page titled 7.5: Exercises was last modified on Wed, 08 Sep 2021 02:57:28 GMT and is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by James M. Fiore via source content that was edited to the style and standards of the LibreTexts platform.
The book could not be loaded just now.