Example 1: Java program to print the numbers using for loop
KW.java
Output
kodingwindow@kw:~$ javac KW.java
kodingwindow@kw:~$ java KW 0 1 2 3 4 5 6 7 8 9 10 kodingwindow@kw:~$
Example 2: Java program to print the numbers using for loop
KW.java
Output
kodingwindow@kw:~$ javac KW.java
kodingwindow@kw:~$ java KW -5 -4 -3 -2 -1 0 1 2 3 4 5 kodingwindow@kw:~$
Example 3: Java program to print the numbers using for loop
KW.java
Output
kodingwindow@kw:~$ javac KW.java
kodingwindow@kw:~$ java KW 5 4 3 2 1 0 -1 -2 -3 -4 -5 kodingwindow@kw:~$
Example 4: Java program to print the numbers using for loop
KW.java
Output
kodingwindow@kw:~$ javac KW.java
kodingwindow@kw:~$ java KW 1 2 3 4 5 kodingwindow@kw:~$
What Next?
Java program to print the star pyramid patterns
Java program to find the factorial of a given number
Java Strings
Advertisement