Advertisement
Spocoman

07. Repeat String

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