// Demonstrating the use of a while loop with a // counter. // Week 2, Lecture 3 // Problem: I want to count from 1-10! #include int main (void){ // 1. Declare and initialise the loop control variable (counter) // 2. Test the loop counter // 3. Update the loop control variable /*// 1. Declare and intilise a variable int hours = 0; // This is my first hour printf("Did you get a ticket to Taylor? "); char answer; scanf(" %c", &answer); hours = hours + 1; // This is my second hour printf("Did you get a ticket to Taylor? "); scanf(" %c", &answer); hours = hours + 1; */ // 1. Declare and initialise something to control // my loop with. int hours = 0; // hours 0 // 3 < 3 ? FALSE while (hours < 3){ printf("Did you get a ticket to Taylor? "); char answer; // answer scanf(" %c", &answer); // answer n hours = hours + 1; // 3. Updated the control variable // hours 3 } // hours = 3 return 0; }