Advertisement
gospod1978

MidExam/Group1/Biscuits Factory

Nov 12th, 2019
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.05 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5. namespace fundamental14
  6. {
  7.     class MainClass
  8.     {
  9.         public static void Main()
  10.         {
  11.             int bisquut = int.Parse(Console.ReadLine());
  12.             int worker = int.Parse(Console.ReadLine());
  13.             int secondFactory = int.Parse(Console.ReadLine());
  14.            
  15.             double sum = 0;
  16.             int prodDay = bisquut * worker;
  17.            
  18.            
  19.             for (int i = 1; i <= 30; i++)
  20.             {
  21.                 if (i % 3 == 0)
  22.                 {
  23.                     sum += Math.Floor(prodDay * 0.75);
  24.                 }
  25.                 else
  26.                 {
  27.                     sum += prodDay;
  28.                 }
  29.             }
  30.             Console.WriteLine($"You have produced {sum} biscuits for the past month.");
  31.             double result = 0;
  32.             double press = 0;
  33.             if (sum > secondFactory)
  34.             {
  35.                 result = sum - secondFactory;
  36.                 press = (result / secondFactory) * 100;
  37.                 Console.WriteLine($"You produce {press:f2} percent more biscuits.");
  38.             }
  39.             else
  40.             {
  41.                 result = secondFactory - sum;
  42.                 press = (result / secondFactory) * 100;
  43.                 Console.WriteLine($"You produce {press:f2} percent less biscuits.");
  44.             }
  45.         }
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement