Advertisement
dmitryEfremov

Untitled

Apr 29th, 2020
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.20 KB | None | 0 0
  1. using System;
  2. namespace ConsoleApp5
  3. {
  4.     class Program
  5.     {
  6.         static void Main(string[] args)
  7.         {
  8.             while (true)
  9.             {
  10.                 Console.WriteLine("Введите процент");
  11.                 int percent = Convert.ToInt32(Console.ReadLine());
  12.                 int number = Calculation(percent);
  13.                 Drawing(number);                
  14.                 Console.ReadLine();
  15.                 Console.Clear();
  16.             }
  17.         }
  18.  
  19.         static int Calculation(int percent)
  20.         {
  21.             double onePartPercent = 0.09;
  22.             int priorityPart = 0;
  23.             int part = 0;
  24.             return part = Convert.ToInt32(Math.Round(percent * onePartPercent));
  25.         }
  26.  
  27.         static void DrawingBar(int number)
  28.         {
  29.             Console.Write("[");
  30.             Console.BackgroundColor = ConsoleColor.Red;
  31.             for(int i = 0; i < number; i++)
  32.             {
  33.             Console.Write('#');
  34.             }
  35.             Console.BackgroundColor = ConsoleColor.Black;
  36.             for (int i = number; i < 9; i++)
  37.             {
  38.                 Console.Write('_');
  39.             }
  40.             Console.Write("]");
  41.         }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement