Advertisement
Spocoman

AND Processors

Aug 26th, 2022 (edited)
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.21 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ANDProcessors
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int processors = int.Parse(Console.ReadLine());
  10.             int workers = int.Parse(Console.ReadLine());
  11.             int days = int.Parse(Console.ReadLine());
  12.  
  13.             double diff = (processors - Math.Floor(workers * days * 8 / 3D)) * 110.10;
  14.  
  15.             if (diff > 0)
  16.             {
  17.                 Console.WriteLine($"Losses: -> { diff:F2} BGN");
  18.             }
  19.             else
  20.             {
  21.                 Console.WriteLine($"Profit: -> { Math.Abs(diff):F2} BGN");
  22.             }
  23.         }
  24.     }
  25. }
  26.  
  27. РЕШЕНИЕ С ТЕРНАРЕН ОПЕРАТОP:
  28.  
  29. using System;
  30.  
  31. namespace ANDProcessors
  32. {
  33.     class Program
  34.     {
  35.         static void Main(string[] args)
  36.         {        
  37.             int processors = int.Parse(Console.ReadLine());
  38.             int workers = int.Parse(Console.ReadLine());
  39.             int days = int.Parse(Console.ReadLine());
  40.  
  41.             double diff = (processors - Math.Floor(workers * days * 8 / 3D)) * 110.10;
  42.  
  43.             Console.WriteLine($"{(diff > 0 ? "Losses" : "Profit")}: -> { Math.Abs(diff):F2} BGN");
  44.         }
  45.     }
  46. }
  47.  
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement