IvetValcheva

07. Fruit Market

Apr 4th, 2021
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.04 KB | None | 0 0
  1. using System;
  2.  
  3. namespace FirstStepsInCodding
  4.     {
  5.         class Program
  6.         {
  7.             static void Main(string[] args)
  8.             {
  9.             double berriesPrice = double.Parse(Console.ReadLine());
  10.  
  11.             double banana = double.Parse(Console.ReadLine());
  12.             double orange = double.Parse(Console.ReadLine());
  13.             double raspberry = double.Parse(Console.ReadLine());
  14.             double berry = double.Parse(Console.ReadLine());
  15.  
  16.             double raspberriesPrice = berriesPrice / 2;
  17.             double orangePrice = raspberriesPrice - raspberriesPrice * 40 / 100;
  18.             double bananaPrice = raspberriesPrice - raspberriesPrice * 80 / 100;
  19.  
  20.             double bananaSum = bananaPrice * banana;
  21.             double orangeSum = orangePrice * orange;
  22.             double raspberrySum = raspberriesPrice * raspberry;
  23.             double berrySum = berriesPrice * berry;
  24.  
  25.             double sum = bananaSum + orangeSum + raspberrySum + berrySum;
  26.  
  27.             Console.WriteLine($"{sum:F2}");
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment