Write a program to print ###....nth times then n(n-1)(n-2)..........1. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Write a program to print ###....nth times then n(n-1)(n-2)..........1.

take n as input n using one loop only. And all thr hash should print in next line eg: if n=3 then output will be:- # # # 3 2 1

2nd Jul 2017, 7:06 AM
Sahil Luthra
Sahil Luthra - avatar
9 Answers
+ 4
wong @Salekin please reread the question n required output...
2nd Jul 2017, 3:54 PM
Sahil Luthra
Sahil Luthra - avatar
+ 3
yes now output is correct but i want this code in java language... can u plz??
3rd Jul 2017, 7:52 AM
Sahil Luthra
Sahil Luthra - avatar
+ 3
wow #kamakshi... gd
10th Aug 2017, 2:57 PM
Sahil Luthra
Sahil Luthra - avatar
+ 3
can u plz elaborate it? for me
10th Aug 2017, 2:59 PM
Sahil Luthra
Sahil Luthra - avatar
+ 1
@Sahil Luthra, I didn't get the q. correctly. Anyway, I've updated the code. https://code.sololearn.com/cR9lSjPNC5hq
3rd Jul 2017, 4:49 AM
Salekin
Salekin - avatar
10th Aug 2017, 2:27 AM
kamakshi
kamakshi - avatar
2nd Jul 2017, 7:54 AM
Salekin
Salekin - avatar
0
Thank you for your encouragement
10th Aug 2017, 2:58 PM
kamakshi
kamakshi - avatar
0
take a input eg: 3 the question is first 3 times print # and next 3 times decrement the n and print so total print counts is double , so I took t=n+n then loop repeats and t decrements, first 3 times as t>n print # and the remaining counts print the number
10th Aug 2017, 3:02 PM
kamakshi
kamakshi - avatar