Advertisement
Qrist

Repeat String

Apr 16th, 2020
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.50 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4. {
  5.     public static void Main(string[] args)
  6.     {
  7.         string repeat = Console.ReadLine();
  8.         int n = int.Parse(Console.ReadLine());
  9.         string result = RepeatString(repeat, n);
  10.         Console.WriteLine(result);
  11.        
  12.     }    
  13.     public static string RepeatString(string word,int count)
  14.     {
  15.         string str = word;
  16.         for (int i = 1; i < count; i++)
  17.         {
  18.             str += word;
  19.         }
  20.         return str;
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement