Teo_Yanchev

Methods - RepeatStrings - C# Fundamentals

Sep 10th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _7.RepearString
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string input = Console.ReadLine();
  10. int repeatNumber = int.Parse(Console.ReadLine());
  11.  
  12. string output = RepeatString(input, repeatNumber);
  13.  
  14. Console.Write(output);
  15. }
  16.  
  17. static string RepeatString(string input, int repeatNumber)
  18. {
  19. string output = string.Empty;
  20. for (int i = 0; i < repeatNumber; i++)
  21. {
  22. output += input;
  23. }
  24.  
  25. return output;
  26. }
  27. }
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment