Advertisement
DrDemonik

Untitled

Mar 23rd, 2019
567
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. using System;
  2. namespace nekrach
  3. {
  4.     class Program
  5.     {
  6.         static void Main(string[] args)
  7.         {
  8.             Console.WriteLine("Введите ваши ХП от 0 до 100");
  9.             PrintHealBar(Convert.ToInt32(Console.ReadLine()));
  10.         }        
  11.  
  12.         static void PrintHealBar(int hp)
  13.  
  14.         {
  15.             int n = hp / 10;
  16.             Console.Write("[");
  17.             for(int i = 0; i < 10; i++)
  18.             {
  19.                 if (i < n)
  20.                     Console.Write("#");
  21.                 else
  22.                     Console.Write("_");
  23.             }
  24.             Console.Write("[");
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement