RadoslavStamboliev

04.Парична награда

Aug 1st, 2017
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Парична_награда
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int partsProjects = int.Parse(Console.ReadLine());
  14.             double priceForPoint = double.Parse(Console.ReadLine());
  15.             var sum = 0;
  16.            
  17.             var TotalPrice = 0.0;
  18.             for (int i = 0; i < partsProjects; i++)
  19.             {
  20.                 var points = int.Parse(Console.ReadLine());
  21.                 if (points % 2 == 0)
  22.                 {
  23.                     points= points * 2;
  24.                    
  25.                 }
  26.                 else
  27.                 {
  28.                     points++;
  29.                    
  30.                 }
  31.                 sum +=points;
  32.                 TotalPrice = (sum * priceForPoint) ;
  33.             }
  34.            
  35.             Console.WriteLine($"{TotalPrice:F2}");
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment