// for loop and while loop
public class ForWhile {
public static void main(String[] args) {
for (int i = 1; i <= 5; i++) {
int j = i;while (j <= 5) {
System.out.print(j);
j++;
}System.out.println(" ");
}
}
}
Output:* * * * *
* * * *
* * *
* *
*
// for loop and while loop
public class ForWhile {
public static void main(String[] args) {
for (int i = 1; i <= 5; i++) {
int j = i;while (j <= 5) {
System.out.print(j);
j++;
}System.out.println(" ");
}
}
}
Output:* * * * *
* * * *
* * *
* *
*
Program to check Prime Number using for loop in java
Conditional Operators Examples 2 in Java
Program to check Armstrong number in Java
Program to draw line in Applet using drawLine() method in Java
Program to use Wrapper class with switch statement in Java
Take Input from User through Console in Java
Program to use GridBagLayout in Java
Nested while Loop example in Java
Program to draw Polygon in Applet using drawPolygon() method in Java
setLength() method example in Java
Using class with import example in Java
Program to use File class and its methods in Java
Program to get Maximum element from Array in Java
Program to calculate commission of salesman in Java