Advertisement
YORDAN2347

AccountBalance

Nov 28th, 2020
1,180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.55 KB | None | 0 0
  1. using System;
  2.  
  3. namespace AccountBalance
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double balance = 0.0;
  10.             string money = Console.ReadLine();
  11.            
  12.             while(money != "NoMoreMoney")
  13.             {
  14.                 money = double.Parse(money);
  15.  
  16.                 if (money < 0)
  17.                 {
  18.                     Console.WriteLine("InvalidOperation!");
  19.                     break;
  20.                 }
  21.  
  22.                 balance += money;
  23.             }
  24.         }
  25.     }
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement