Advertisement
silvana1303

biscuits factory

Jun 14th, 2020
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.37 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Linq;
  5. using System.Threading;
  6.  
  7. namespace ConsoleApp1
  8. {
  9.     class Exam
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double biscuits = double.Parse(Console.ReadLine());
  14.             int workers = int.Parse(Console.ReadLine());
  15.             int concurent = int.Parse(Console.ReadLine());
  16.  
  17.             double production = 0;
  18.  
  19.             for (int i = 1; i <= 30; i++)
  20.             {
  21.        
  22.                 if (i % 3 == 0)
  23.                 {
  24.                     production += Math.Floor(biscuits * workers * 0.75);
  25.                 }
  26.                 else
  27.                 {
  28.                     production += biscuits * workers;
  29.                 }
  30.             }
  31.  
  32.             Console.WriteLine($"You have produced {production} biscuits for the past month.");
  33.  
  34.             if (production > concurent)
  35.             {
  36.                 double percentage = (production - concurent) / concurent * 100.0;
  37.                 Console.WriteLine($"You produce {percentage:F2} percent more biscuits.");
  38.             }
  39.             if (production < concurent)
  40.             {
  41.                 double percentage = (concurent - production) / concurent * 100.0;
  42.                 Console.WriteLine($"You produce {percentage:F2} percent less biscuits.");
  43.             }
  44.         }
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement