CodShot
Java Public

Print numbers from 1 to 5

This Java program uses a for loop to print numbers from 1 to 5 on the console.

Java
public class SimpleLoop {
    public static void main(String[] args) {
        for (int i = 1; i <= 5; i++) {
            System.out.println(i);
        }
    }
}

Snippet actions

Pluto
Pluto
Updated: 2026-09-07 12:26
Public snippets
0
Forks
CodShot AI Help
Ask about CodShot features, plans, workspace, AI limits, referrals, and public help topics.
Hi! I can help you understand how CodShot works. What would you like to know?
For account-specific or sensitive issues, please open a support ticket. Open support