Wednesday, 3 August 2016

Number Patterns

Question No:9
i/p: 5 
1        1
12      21
123    321
1234  4321
1234554321


 
import java.util.Scanner;
public class Pat {
    public static void main(String[] args) {
        int n=5;
        for(int i=1;i<=n;i++){
            for(int j=1;j<=i;j++){
                System.out.print(j);
            }
            for(int j=1;j<=2*(n-i);j++){
                System.out.print(" ");
            }
            for(int j=i;j>0;j--){
                System.out.print(j);
            }
            System.out.println();
        }
    }
}

1 comment:

  1. How to Get £40 + 100 Free Spins for Every Single Gambler
    Get £40 + 100 Free Spins for Every Single Gambler. The bonus funds, including £10 free spins and 10 spins are available luckyclub to you at any of the

    ReplyDelete

Featured post

All Logical Questions are Answered JumpInToIt