Advertisement
KrasenPenev

balance

Feb 13th, 2020
426
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Account_Balance
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int entries = int.Parse(Console.ReadLine());
  14. int counter = 1;
  15. double currentSum = 0;
  16.  
  17. while (counter <= entries)
  18. {
  19. double income = double.Parse(Console.ReadLine());
  20. if (income < 0)
  21. {
  22. Console.WriteLine("Invalid operation!");
  23. break;
  24. }
  25. else
  26. {
  27. currentSum += income;
  28. Console.WriteLine($"Increase: {income:f2}");
  29. }
  30. counter++;
  31. }
  32. Console.WriteLine($"Total: {currentSum}");
  33. }
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement