Print Integer in Java


Q. Write a Java program to print 100 integer numbers

 public class Print100Integers {
    public static void main(String[] args) {
        // Loop from 1 to 100 and print each number
        for (int i = 1; i <= 100; i++) {
            System.out.println(i);
        }
    }
}

Q. Write an algorithm to print 100 integer numbers

1. Start
2. Initialize an integer variable i to 1
3. Repeat steps 4–5 while i <= 100
4. Print the value of i
5. Increment i by 1
6. End 



OnlineTpoint is a website that is meant to offer basic knowledge, practice and learning materials. Though all the examples have been tested and verified, we cannot ensure the correctness or completeness of all the information on our website. All contents published on this website are subject to copyright and are owned by OnlineTpoint. By using this website, you agree that you have read and understood our Terms of Use, Cookie Policy and Privacy Policy.