Advertisement
Valantina

Savings/Ex27.07.2019

Jul 29th, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.65 KB | None | 0 0
  1. using System;
  2.  
  3. namespace P01_Savings
  4. {
  5.     class P01_Savings
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double incomePerMonth = double.Parse(Console.ReadLine());
  10.             int months = int.Parse(Console.ReadLine());
  11.             double personalExpenses = double.Parse(Console.ReadLine());
  12.  
  13.             double moneyLeft = incomePerMonth - personalExpenses - (incomePerMonth * 0.3);
  14.             double percent = moneyLeft / incomePerMonth * 100;
  15.             double sum = moneyLeft * months;
  16.  
  17.             Console.WriteLine($"She can save {percent:F2}%");
  18.             Console.WriteLine($"{sum:F2}");
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement