// A while inside a while (tick tock) // Demonstrating how you can put a while inside a while to print out a // grid of numbers // Sasha Vassar Week 2, Lecture 3 #include /* Problem: Print out a grid of numbers that looks like this: 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 So we are printing out a square... Each row sees the numbers increase by one, and then we go back to 1 when we start in the next row. Can you print out one row of numbers? */ int main (void) { //Print out one row //Loop control variable int size; printf("Enter the size of square grid side you want to print: "); scanf("%d", &size); int row = 1; while (row <= size) { int col = 1; while (col <= size) { //2. Test printf("%d ", col); //3. Update the loop control col = col + 1; } printf("\n"); row = row + 1; } return 0; }