anizko

07. Repeat String

Jul 2nd, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.69 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _07._Repeat_String
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string stringToRepeat = Console.ReadLine();
  10.             int repeatCount = int.Parse(Console.ReadLine());
  11.             string repeatedString = MakeRepeatedString(stringToRepeat, repeatCount);
  12.  
  13.             Console.WriteLine(repeatedString);
  14.         }
  15.  
  16.         static string MakeRepeatedString (string stringToRepeat,int repeatCount)
  17.         {
  18.             string repeat = string.Empty;
  19.             for(int i=1; i<= repeatCount; i++)
  20.             {
  21.                 repeat += stringToRepeat;
  22.             }
  23.             return repeat;
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment