Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Account_Balance
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- double totalAmount = 0;
- while (input != "NoMoreMoney")
- {
- double currentAmount = double.Parse(input);
- if (currentAmount < 0)
- {
- Console.WriteLine("Invalid operation!");
- break;
- }
- totalAmount += currentAmount;
- Console.WriteLine($"Increase: {currentAmount:F2}");
- input = Console.ReadLine();
- }
- Console.WriteLine($"Total: {totalAmount:F2}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement