Pattern program 9



	public class pattern9 {
		public static void main( String arg[]){
			int ck=0,c=2;
			while(c>0){
				if(ck==0){
					for(int i=1,r=5;i<=5;i++,r--){
						for(int j=1;j<=r;j++){
							System.out.print(j);
						}
						System.out.println();
					}
					ck++;
				} else{
				for(int i=2;i<=5;i++){
					for(int j=1;j<=i;j++){
						System.out.print(j);
					}
					System.out.println();
				}
			c--;
			}
		}
	}

Send by Yawer Moin

	import java.io.*;
	class pattern9 {
		public static void main(String args[]) {
			Console con=System.console();
			int n;
			n=Integer.parseInt(con.readLine());
			for(int i=1,r=n;i<=n;i++,r--) {
				for(int j=1;j<=r;j++)
					System.out.print(j);
				System.out.println();
				if(i==n) {
					for(int j=2;j<=n;j++) {
						for(int k=1;k<=j;k++) {
							System.out.print(k);
						}
						System.out.println();
					}
				}
			}
		}
	}

Comments