Search the courses, subjects, tracks, games and features, or jump straight to a page.
3 cards from this section. Quick, good the night before a test.
Write a for loop to print numbers from 1 to 10.
Remember to start from 1 and go up to 10.
Modify the loop to print even numbers from 2 to 20.
Think about how you can skip odd numbers.
What does a for loop do in programming?
Think about the purpose of loops.
True or False: A for loop can iterate through an array.
Recall how we've used for loops with arrays in class.
Using a for loop, write a program to print a triangle of asterisks where the number of rows is provided by the user.
You will need a nested loop to manage the number of asterisks in each row.
Create a for loop that reverses a string provided by the user and prints it.
You will iterate from the end of the string to the beginning.
6 more questions in this section. Enroll free to practise them all.
Enroll free