SHARE
TWEET

Functional Programming - 4. Add VAT

gabi11 May 25th, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6.  
  7.  
  8. namespace CSharpAdvanced
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             double[] prices = Console.ReadLine()
  15.                 .Split(", ", StringSplitOptions.RemoveEmptyEntries)
  16.                 .Select(double.Parse)
  17.                 .Select(p => p * 1.2)
  18.                 .ToArray();
  19.  
  20.             foreach (var price in prices)
  21.             {
  22.                 Console.WriteLine($"{price:f2}");
  23.             }
  24.         }
  25.     }
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top