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

How to print stars?

You need to create a function that takes a number X as its parameter and outputs X stars using the asterisk symbol *. x <- readLines('stdin') x <- as.integer(x[1]) #define the function stars(x) <- function(x) { result <- "*" } print(result)

17th Sep 2021, 6:57 AM
Ammara Tayyab
2 Answers
+ 2
You should use a loop to print stars as much as input. Here, you can check. Happy coding! https://code.sololearn.com/c51L1zfgH3Hi/?ref=app
17th Sep 2021, 8:22 AM
mesarthim
mesarthim - avatar
+ 2
You can use a for loop and print the * for each iteration.
17th Sep 2021, 7:24 AM
Simba
Simba - avatar