desito07

Untitled

Oct 7th, 2023
1,348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.85 KB | None | 0 0
  1. namespace Account_Balance__new_version_;
  2. class Program
  3. {
  4.     static void Main(string[] args)
  5.     {
  6.         string command = Console.ReadLine();
  7.         double sum = 0.0;
  8.  
  9.         while (command != "End!")
  10.         {
  11.             double currentDeposit = double.Parse(command);
  12.             sum += currentDeposit;
  13.             if(currentDeposit > 0)
  14.             {
  15.                 Console.WriteLine($"Increase: {currentDeposit:f2}");
  16.             }
  17.  
  18.            
  19.             if(currentDeposit < 0)
  20.             {
  21.                 Console.WriteLine($"Decrease: {Math.Abs(currentDeposit):f2}");
  22.                 break;
  23.             }
  24.  
  25.             /*if (currentDeposit == 0)
  26.             {
  27.                 break;
  28.             }*/
  29.            
  30.             command = Console.ReadLine();
  31.         }
  32.         Console.WriteLine($"Balance: {sum:f2}");
  33.     }
  34. }
  35.  
  36.  
Advertisement
Add Comment
Please, Sign In to add comment