006-001-013
Basic For Loop
Easy
Problem Description
Basic for loop
In this problem, you will create a program that uses a for loop to display numbers 1 through 5 sequentially and calculates their sum, displaying the result to standard output.
Learning Objective: Understand the basics of repetitive processing with Java for loops
Overview
The for loop repeats processing a specified number of times. It consists of three parts: initialization, condition, and update expressions.
Specifications
- Use a for loop to display numbers 1 through 5
- Use a for loop to calculate and display the sum of 1 through 5
Output Format
1
2
3
4
5
Sum: 15
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up