Advertisement
unrealbg

Untitled

Jan 21st, 2021 (edited)
582
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.11 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Dieta
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double berriesPrice = double.Parse(Console.ReadLine());
  10.             double bananasQuantity = double.Parse(Console.ReadLine());
  11.             double orangesQuantity = double.Parse(Console.ReadLine());
  12.             double raspberriesQuantity = double.Parse(Console.ReadLine());
  13.             double berriesQuantity = double.Parse(Console.ReadLine());
  14.  
  15.             double raspberriesPrice = berriesPrice / 2;
  16.             double orangesPrice = raspberriesPrice - (raspberriesPrice * 0.4);
  17.             double bananasPrice = raspberriesPrice - (raspberriesPrice * 0.8);
  18.  
  19.             double berriessSum = berriesPrice * berriesQuantity;
  20.             double bananasSum = bananasPrice * bananasQuantity;
  21.             double orangesSum = orangesPrice * orangesQuantity;
  22.             double rasperriesSum = raspberriesPrice * raspberriesQuantity;
  23.  
  24.             double moneyNeeded = bananasSum + berriessSum + orangesSum + rasperriesSum;
  25.  
  26.             Console.WriteLine($"{moneyNeeded:f2}");
  27.         }
  28.     }
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement