Advertisement
gospod1978

Methods/Repeat String

Oct 11th, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.58 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace Methods
  5. {
  6.     public class Methods
  7.     {
  8.         public static void Main()
  9.         {
  10.             string word = Console.ReadLine().ToLower();
  11.  
  12.             int repeat = int.Parse(Console.ReadLine());
  13.  
  14.             Console.WriteLine(Repeat(word, repeat));
  15.         }
  16.  
  17.         public static string Repeat(string word, int repeat)
  18.         {
  19.             string result = "";
  20.  
  21.             for (int i = 0; i < repeat; i++)
  22.             {
  23.                 result += word;
  24.             }
  25.  
  26.             return result;
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement