Solution for Exercise 9-17

ex0917

#include <stdio.h>

int main()
{
    int x;

    x=13;
    do
    {
        puts("Sore shoulder surgery");
        x=x+1;
    } while(x<10);
    return(0);
}

Notes

* The code outputs text because the do-while loop is guaranteed to spin at least once. That's true even though the value 13 is out of range for the while condition.

* Remember: do-while loops always execute once.