kwest87

Untitled

Apr 12th, 2022
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.80 KB | None | 0 0
  1. [StartCode]
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace ConsoleApp12
  9. {
  10.     internal class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             int apple = 5;
  15.             int maxApple = 10;
  16.             drawBar(apple, maxApple);
  17.         }
  18.  
  19.         static void drawBar(int amount, int maxAmount)
  20.         {
  21.             string bar = "";
  22.  
  23.             for (int i = 0; i < amount; i++)
  24.             {
  25.                 bar += "#";
  26.             }
  27.  
  28.             for(int i = amount; i < maxAmount; i++)
  29.             {
  30.                 bar += "_";
  31.             }
  32.  
  33.             Console.Write("[");
  34.             Console.Write(bar);
  35.             Console.WriteLine("]");
  36.         }
  37.     }
  38. }
  39. [EndCode]
Advertisement
Add Comment
Please, Sign In to add comment