Uploaded by u23power

Quiz 4

advertisement
Quiz 4
Take 5.12 from the text (below) and convert the while loop to a for loop. Also try to make the count
right – starting at 100 and ending at 0.
#include <stdio.h>
#define MAX 100
int main(void)
{
int count = MAX + 1;
while (count-- > 0) {
printf("%d bottles of spring water on the wall, "
"%d bottles of spring water!\n", count, count);
printf("Take one down and pass it around,\n");
printf("%d bottles of spring water!\n\n", count - 1);
}
return 0;
}
Download