How to print string n times? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to print string n times?

I want to print the string repeatedly n times with simple c language code. Like print string "SK" 4 times SKSKSKSK.

30th Apr 2020, 4:42 PM
Katkar Shekhar
Katkar Shekhar - avatar
7 Answers
+ 2
This thing is covered already in your C course which you have already completed 100%. You need to revise them once again to be able to solve this. your problem seems to have logic with repetition so you need something like a loop which loop I don't know.
30th Apr 2020, 4:51 PM
Rohit
+ 2
yeah why know, but have you tried solving yourself? show your attempt and we can try to make it work together.
30th Apr 2020, 4:55 PM
Rohit
+ 2
Yeah im trying on it..... Thnx bdw... 😊
30th Apr 2020, 4:57 PM
Katkar Shekhar
Katkar Shekhar - avatar
+ 2
thanks yourself because you are challenging your brain and this is what will help you alot in your long run. But if you have doubt please post it. Happy Coding!
30th Apr 2020, 5:11 PM
Rohit
+ 1
Yes ill search..... But value of n given by user and we have to print that string n times so it will happen... And i have tried for loop it will not show output using for loop it shows problem
30th Apr 2020, 4:54 PM
Katkar Shekhar
Katkar Shekhar - avatar
+ 1
Simply use * operator on string you will find your ans
29th Sep 2020, 8:52 PM
sarthak bhardwaj
sarthak bhardwaj - avatar
0
"SK"*4
29th Sep 2020, 8:53 PM
sarthak bhardwaj
sarthak bhardwaj - avatar