Search the courses, subjects, tracks, games and features, or jump straight to a page.
5 cards from this section. Quick, good the night before a test.
Write a for loop that prints numbers from 1 to 10.
Remember to initialize, check the condition, and increment the variable!
What will this loop print: for (int i = 0; i < 3; i++) { System.out.println(i); }?
Think about how many times this loop will run.
What is the syntax structure for a for loop?
Think about the roles of each part.
True or False: The for loop can execute zero times?
Consider what happens before the loop starts.
Create a program that prints the first ten Fibonacci numbers using a for loop.
You need to keep track of the last two numbers to calculate the next.
How would you use a for loop to reverse a string given as input?
Remember to access the string in reverse order.
6 more questions in this section. Enroll free to practise them all.
Enroll free