Showing posts with label to print numbers in plus pattern. Show all posts
Showing posts with label to print numbers in plus pattern. Show all posts

Thursday, 20 July 2017

To print numbers in plus(+) pattern

public class Pattern {
public static void main(String[] args) {
    for(int i=1;i<=5;i++){
        System.out.println("        "+i);
    }
    for(int i=1;i<=10;i++){
        System.out.print(i+" ");
    }System.out.println();
    for(int i=6;i<=10;i++){
        System.out.println("        "+i);
    }
}
}





OUTPUT:

           1
           2
           3
           4
1 2 3 4 5 6 7 8 9 10
           6
           7
           8
           9
          10