anizko

03. Account Balance

Apr 4th, 2019
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.80 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Account_Balance
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int CountVnoski = int.Parse(Console.ReadLine());
  10.             double total = 0;
  11.            
  12.             while(CountVnoski != 0)
  13.             {
  14.                 double Vnoska = double.Parse(Console.ReadLine());
  15.                 if (Vnoska > 0)
  16.                 {
  17.                     Console.WriteLine($"Increase: {Vnoska:f2}");
  18.                    
  19.                     CountVnoski--;
  20.                 }
  21.                 else
  22.                 {
  23.                     Console.WriteLine("Invalid operation!");
  24.                     break;
  25.                 }
  26.                 total += Vnoska;
  27.             }
  28.  
  29.  
  30.             Console.WriteLine($"Total: {total:f2}");
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment