Here you can find all type of number series programs (if i miss any series please send me in Here)
Program: 1
Program: 1
public class HelloWorld{ public static void main(String []args){ for(int i=1;i<=5;i++){ for(int j=1;j<=5;j++){ System.out.print(j); } System.out.println(""); } } }Output:
1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5Program: 2
public class HelloWorld{ public static void main(String []args){ for(int i=1;i<=5;i++){ for(int j=1;j<=5;j++){ System.out.print(i); } System.out.println(""); } } }Output:
1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5Program: 3
public class HelloWorld{ public static void main(String []args){ for(int i=1;i<=5;i++){ for(int j=1;j<=i;j++){ System.out.print(i); } System.out.println(""); } } }Output:
1 2 2 3 3 3 4 4 4 4 5 5 5 5 5Program: 4
public class HelloWorld{ public static void main(String []args){ for(int i=1;i<=5;i++){ for(int j=1;j<=i;j++){ System.out.print(j); } System.out.println(""); } } }Output:
1 1 2 1 2 3 1 2 3 4 1 2 3 4 5Program: 5
public class HelloWorld{ public static void main(String []args){ for(int i=1;i<=5;i++){ for(int j=i;j<=5;j++){ System.out.print(i); } System.out.println(""); } } }Output:
1 1 1 1 1 2 2 2 2 3 3 3 4 4 5
No comments:
Post a Comment