Thinking in Java Fourth Edition Bruce Eckel Chapter 3 Exercise 1

Exercise 1: Write a program that prints values from 1 to 100.

Solution:

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

Output:

Leave a Reply

Your email address will not be published. Required fields are marked *