For loop in java

Code to print numbers from 1 to 100 by for loop in java

Hi @AkshiAhuja, welcome to the community!

To print numbers from 1-100 in a for loop, you can add the following code to your file:

for (int i = 1; i <= 100; i++) {

In this code, i is assigned an integer (1), then the loop checks if i is less than or equal to 100, and then i is incremented by 1 each time the loop runs. This prints numbers from 1-100 to the console output. Hope this helps :grin:


:wave: Welcome to the forums, @AkshiAhuja!

It seems that this post is asking for answers to a school assignment. It is against Replit Ask policy for community members to request or post complete answers to homework-like questions. On the other hand, the community can assist you in working through and understanding the core fundamentals of computer programming to help you figure out your question by yourself, though.

1 Like