Skip to content

Commit

Permalink
Create Number Pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
omkar-ghotekar authored Jun 2, 2020
1 parent 3b298df commit 79b2e38
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions Number Pattern
Original file line number Diff line number Diff line change
@@ -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(" ");

}

}
}

0 comments on commit 79b2e38

Please sign in to comment.