Advertisement
YavorGrancharov

String_Repeater_(Methods)

Jun 13th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace String_Repeater
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string word = Console.ReadLine();
  14.             int count = int.Parse(Console.ReadLine());
  15.  
  16.             string repeated = RepeatString(word, count);
  17.             Console.WriteLine(repeated);
  18.         }
  19.  
  20.         static string RepeatString(string word, int count)
  21.         {
  22.             string repeated = string.Empty;
  23.  
  24.             for (int i = 0; i < count; i++)
  25.             {
  26.                 repeated += word;
  27.             }
  28.             return repeated;
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement