/* Michael Redmond */ /* Assignment 7 - Bing Bang and Buzz */ /* 03/07/01 */ /* Bug introduced for debugging lab */ #include #include "divides.h" int main() { int numToDo; int cnt; int empty; int numEmpty; numEmpty = 0; /* how many to go through? */ printf("How many numbers to process? "); scanf("%d",&numToDo); /* process all numbers until get to user specified limit */ for (cnt = 1; cnt < numToDo; cnt++) { /* default to no words found */ empty = 1; /* display the number */ printf("\n %5d ",cnt); /* print bing if divisible by 3 */ if (dividesEven(cnt,3)) { printf(" bing "); /* indicate that word was found */ empty = 0; } /* print bang if divisible by 5 */ if (dividesEven(cnt,5)) { printf(" bang "); /* indicate that word was found */ empty = 0; } /* print buzz if divisible by 7 */ if (dividesEven(cnt,7)) { printf(" buzz "); } /* update count of numbers with no sounds */ if (empty) { numEmpty++; } } printf("\n %4d numbers had no sounds \n",numEmpty); return 0; }