From 79b2e388c0fbccb5c16434bd40ce36ffcd33dcf6 Mon Sep 17 00:00:00 2001 From: OMKAR GHOTEKAR Date: Tue, 2 Jun 2020 22:21:26 +0530 Subject: [PATCH] Create Number Pattern --- Number Pattern | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Number Pattern diff --git a/Number Pattern b/Number Pattern new file mode 100644 index 0000000..c0096db --- /dev/null +++ b/Number Pattern @@ -0,0 +1,48 @@ +Print the following pattern + +Pattern for N = 4 + +1 +23 +345 +4567 + + +JAVA CODE:- + + + + import java.util.*; +public class Solution { + + + public static void main(String[] args) { + + /* Your class should be named Solution. + * Read input as specified in the question. + * Print output as specified in the question. + */ + + Scanner sc=new Scanner(System.in); + int n=sc.nextInt(); + + + int i, j, k; + + for(i=1; i<=n; i++) + { + k = i; + + // Logic to print numbers + for(j=1; j<=i; j++) + { + System.out.print(k); + k++; + } + + System.out.println(" "); + + } + +} +}