Advertisement
Guest User

Ex4.2

a guest
Oct 22nd, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.77 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Ex4._2
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             Console.WriteLine("Введите количество процентов: ");
  10.             int temp = Convert.ToInt32(Console.ReadLine());
  11.             Console.WriteLine($"{temp}%");
  12.             PrintHealthBar(temp);
  13.         }
  14.  
  15.         static void PrintHealthBar(int procent)
  16.         {
  17.             Console.Write("[");
  18.             int position = Convert.ToInt32(procent / 10.0);
  19.             for (int i = 0; i < 10; i++)
  20.             {
  21.                 if (i < position)
  22.                     Console.Write("#");
  23.                 else
  24.                     Console.Write("_");
  25.             }
  26.             Console.WriteLine("]");
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement