pallindromic_number_pattern
unknown
java
8 months ago
993 B
1
Indexable
Never
import java.util.*; public class NumberPallindromic { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int st=1; int sp=n-1; sc.close(); int number_of_line=1; while (number_of_line <=n) { //print spaces for(int i=0; i < sp; i++){ System.out.print(" "); } //print numbers int current_num=number_of_line; for(int i=0; i<st; i++){ System.out.print(current_num+" "); if(i < st/2){ current_num--; }else{ current_num++; } } //next line System.out.println(); sp--; st+=2; number_of_line++; } } }