java
Number code is using while loops
public class number {
public static void main(String args){
int i = 0;
while(i <= 100)
{
System.out.println(i+"");
}
}
}
This will output the numbers from 1 to 100, each on a new line.
MORE............
public class PrintNumbers {
public static void main(String[] args) {
for (int i = 1; i <= 100; i++) {
System.out.println(i);
}
}
}
```
### Explanation:
1. **Class Declaration**: `public class PrintNumbers` defines the class.
2. **Main Method**: `public static void main(String[] args)` is the entry point of the program.
3. **For Loop**: `for (int i = 1; i <= 100; i++)` initializes `i` to 1 and increments it by 1 until it reaches 100.
4. **Print Statement**: `System.out.println(i);` prints the current value of `i`.
### Running the Program:
1. Save the code in a file named `PrintNumbers.java`.
2. Compile it using the command: `javac PrintNumbers.java`.
3. Run it using: `java PrintNumbers`.
This will output the numbers from 1 to 100, each on a new line.