1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Trying to have an output repeat

  1. Apr 25, 2010 #1
    How do you make a string repeat itself for a given number of times?
    For example, if I wanted to make "3y" print out "yyy" on the screen (it prints "y" 3 times because the number in the input is 3).. how would i do this using functions?
     
  2. jcsd
  3. Apr 26, 2010 #2
    you could just parse the input string; but of course, you will need to include some specifications, or the input/output you want can be very vague ('33y') can be 33 times of y or 3 times of 3y.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook