TheBulgarianWolf

Biscuits Factory

Jan 17th, 2021 (edited)
412
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.59 KB | None | 0 0
  1. using System;
  2.  
  3. namespace MidExamSoftUni
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             Console.WriteLine("Enter the number of biscuits a worker produces per day: ");
  10.             int biscuitsPerDay = int.Parse(Console.ReadLine());
  11.             Console.WriteLine("Enter the number of workers in the factory: ");
  12.             int workersCount = int.Parse(Console.ReadLine());
  13.             Console.WriteLine("Enter the number of biscuits that the \n competing factory produces for 30 days: ");
  14.             int competingFactoryBiscuits = int.Parse(Console.ReadLine());
  15.             int producedFirstDay = biscuitsPerDay * workersCount;
  16.             double producedForAMonth = 0;
  17.             for(int i = 0; i < 10; i++)
  18.             {
  19.                 producedForAMonth += producedFirstDay + producedFirstDay + (int)(0.75*biscuitsPerDay*workersCount);
  20.                
  21.             }
  22.  
  23.             Console.WriteLine("You have produced " + producedForAMonth + " biscuits for the past month.");
  24.             double percent = 0;
  25.             if(producedForAMonth > competingFactoryBiscuits)
  26.             {
  27.                 percent = (producedForAMonth - competingFactoryBiscuits) / competingFactoryBiscuits * 100;
  28.                 Console.WriteLine("You produced {0:F2} percent more biscuits.",percent);
  29.             }
  30.             else
  31.             {
  32.                 percent = (competingFactoryBiscuits - producedForAMonth) / producedForAMonth * 100;
  33.                 Console.WriteLine("You produced {0:F2} percent less biscuits.",percent);
  34.             }
  35.         }
  36.     }
  37. }
  38.  
Add Comment
Please, Sign In to add comment