+ 4

Pattern printing (c, c++, java , python)

N=4 10 4 9 3 5 8 1 2 6 7 And when N=5 15 7 14 6 8 13 2 5 9 12 1 3 4 10 11

10th Dec 2023, 7:46 AM
Saima Shamim
Saima Shamim - avatar
19 Respuestas
+ 3
Hint: you can combine more loops together. Try to find out the logic of a row. By the way please tag your programming language.
10th Dec 2023, 7:57 AM
JaScript
JaScript - avatar
+ 4
I would say that the first row starts from N *3
10th Dec 2023, 8:11 AM
JaScript
JaScript - avatar
+ 3
Yes, I can. But if you want to learn that, the best way will be try to solve that yourself.
10th Dec 2023, 8:26 AM
JaScript
JaScript - avatar
+ 3
First try to code it in any language and show your attempt with a question.
10th Dec 2023, 8:29 AM
JaScript
JaScript - avatar
+ 3
You could save your best try code on Sololearns Playground and link here. Then we can see further. That is the way.
10th Dec 2023, 8:33 AM
JaScript
JaScript - avatar
+ 3
I would like to recommend you working with List<String> or similar methods which allow to replace a character or string on a position. The beginning of a solution and an idea of logic for that you can see here: https://sololearn.com/compiler-playground/c7CQG2ignHv8/?ref=app
11th Dec 2023, 6:05 PM
JaScript
JaScript - avatar
+ 2
Can you solve it?
10th Dec 2023, 8:12 AM
Saima Shamim
Saima Shamim - avatar
+ 2
The range of second row is N*3-1 and the next minus 2 etc.
10th Dec 2023, 8:13 AM
JaScript
JaScript - avatar
+ 2
Saima Shamim have you got any further?
12th Dec 2023, 7:36 PM
JaScript
JaScript - avatar
+ 1
I have tried a lot of time
10th Dec 2023, 8:27 AM
Saima Shamim
Saima Shamim - avatar
+ 1
Hmm ask
11th Dec 2023, 4:08 PM
Saima Shamim
Saima Shamim - avatar
+ 1
Yes I have used another logic
13th Dec 2023, 1:04 AM
Saima Shamim
Saima Shamim - avatar
0
Any language
10th Dec 2023, 7:58 AM
Saima Shamim
Saima Shamim - avatar
0
Can I connect with you on telegram?
10th Dec 2023, 8:30 AM
Saima Shamim
Saima Shamim - avatar
0
Your username please
10th Dec 2023, 8:30 AM
Saima Shamim
Saima Shamim - avatar
0
I have a certain question
11th Dec 2023, 4:05 PM
*#*#4643#*#*
*#*#4643#*#* - avatar
0
Hy
12th Dec 2023, 7:41 AM
Sudaysi Kiiko
Sudaysi Kiiko - avatar
0
for the next row.... 10-(3+3) = 4 , & n = 4, [ 4-1=3] 15-(4+4) = 7 & [ n= 5, [ 5-1= 4] Hope this give you idea....
13th Dec 2023, 12:00 PM
Jayakrishna 🇮🇳