From e318cd53810df1b2bbc580fa651bcc16a803035e Mon Sep 17 00:00:00 2001 From: Anweshan Satapathy <53610465+anweshan2001@users.noreply.github.com> Date: Sat, 9 Oct 2021 17:49:34 +0530 Subject: [PATCH] Gives a pyramid consisting number Hacktoberfest accepted --- FullNumberPyramid.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 FullNumberPyramid.java diff --git a/FullNumberPyramid.java b/FullNumberPyramid.java new file mode 100644 index 0000000..8ebccbd --- /dev/null +++ b/FullNumberPyramid.java @@ -0,0 +1,21 @@ +import java.util.*; +public class FullNumberPyramid { + + public static void main(String[] args) { +Scanner sc=new Scanner(System.in); +int n=sc.nextInt(); +int c=1; +for(int i=1;i<=n;i++) { +for(int j=1;j<=n-i;j++) +{ + System.out.print(" "); +} +for(int k=1;k<=i;k++) +{ + System.out.print(c++ +" "); +} +System.out.println(); +} + } + +}