Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class RepeatString {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String input = scanner.nextLine();
- int n = Integer.parseInt(scanner.nextLine());
- System.out.println(repeatString(input, n));
- }
- public static String repeatString(String textToRepeat, int n) {
- String output = "";
- for (int i = 0; i < n; i++) {
- output += textToRepeat;
- }
- return output;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment