Advertisement
silvana1303

savings

Mar 30th, 2020
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.68 KB | None | 0 0
  1. using System;
  2.  
  3. namespace morexercies
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double paycheck = double.Parse(Console.ReadLine());
  10.             double monthsForSaving = double.Parse(Console.ReadLine());
  11.             double essentials = double.Parse(Console.ReadLine());
  12.  
  13.             double personal = paycheck * 0.3;
  14.             double savedSum = (paycheck - (essentials + personal)) * monthsForSaving;
  15.             double percentage = (savedSum / monthsForSaving / paycheck * 100);
  16.  
  17.  
  18.             Console.WriteLine($"She can save {percentage:f2}%");
  19.             Console.WriteLine($"{savedSum:f2}");
  20.        
  21.  
  22.  
  23.  
  24.  
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement