Computer Science, asked by somyamishra2608, 11 months ago

Decode the logic and print the Pattern that corresponds to given input.

If N= 3

then pattern will be :

10203010011012

**4050809

****607

If N= 4

then pattern will be:

1020304017018019020

**50607014015016

****809012013

******10011

Answers

Answered by amitnrw
23

ANSWER:

There are N number of Rows

1st Row :  1,02....0N 0(N²+1)0(N²+2) ......... 0(N²+N)

2nd Row  **(1+N).....(N-1+N) 0(N²- (N - 2))....            0(N²-1) 0(N²)

.

.

Nth Row 2(N-1)times* (N(N+1)/2 0((N(N+1)/2 + 1)

Explanation:

If N= 3

then pattern will be :

10203010011012

**4050809

****607

If N= 4

then pattern will be:

1020304017018019020

**50607014015016

****809012013

******10011

LOGIC :

There are N number of Rows

1st Row :  1,02....0N 0(N²+1)0(N²+2) ......... 0(N²+N)

2nd Row  **(1+N).....(N-1+N) 0(N²- (N - 2))....            0(N²-1) 0(N²)

.

.

Nth Row 2(N-1)times* (N(N+1)/2 0((N(N+1)/2 + 1)

Similar questions