How to print this | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to print this

1 2 3 12 23 31 123 231 312

19th Dec 2019, 5:29 AM
Kinjal Garg
Kinjal Garg - avatar
7 Answers
+ 6
In above example, 2nd group is : 12 23 31 now, to get 3rd group you need corresponding 2nd group elements + last character of 2nd group elements in some fashion: 12 + ? 23 + ? 31 + 2 = 312 (as 12 having last chr as 2) 2nd + last char in some fashion grp. in some fashion now for these ? ?, fill 3 and 1 as they are last characters of 2nd to 3rd element of 2nd group to get 3rd group as: 123 231 312 Kinjal Garg you need show your attempt that where you are struck or what is your approach to solve the problem to get better community help.
19th Dec 2019, 6:58 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 4
We need some more details from you. First of all please name the problem you have. We also need to know the language you want to use, and in which context / rule the numbers are standing. And you should also show us your attempt in coding.
19th Dec 2019, 6:51 AM
Lothar
Lothar - avatar
+ 4
For numbers from 1 to n, there will be n groups(each having n elements having same number of digits), so to go from kth group to (k+1)th group you need corresponding kth group element + last character of kth group in some fashion like 1st character going to be added to last element, and rest all characters from 2nd to n, will be added to elements from 1st to (n-1)th.
19th Dec 2019, 6:52 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 1
Let me see your code? doesn't matter if it's not working. I might help if you just give it a try, though I haven' t any idea as of now. Which language you plan to do this? please add language specification in your question tags. So you may get effective efficient solution. (Edit) Language specifics added in tags 👍
19th Dec 2019, 6:49 AM
Ipang
+ 1
I want in c language
19th Dec 2019, 6:51 AM
Kinjal Garg
Kinjal Garg - avatar
+ 1
Gaurav Agrawal Actually this is very confusing..can u write code for this?
19th Dec 2019, 6:53 AM
Kinjal Garg
Kinjal Garg - avatar
+ 1
For loop can only print patterns,sequences.. The series you mentioned have no sequence therefore it can not be print via for loop or it will need advance program to print.
20th Dec 2019, 8:43 AM
Ayush Khandelwal
Ayush Khandelwal - avatar