SHARE
TWEET

Ex4.2

a guest Oct 22nd, 2019 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top