Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace BiscuitsFactory
- {
- class MainClass
- {
- public static void Main()
- {
- int biscuitsPerDayPerWorker = int.Parse(Console.ReadLine());
- int countOfWorkers = int.Parse(Console.ReadLine());
- int anotherFactoryProductionFor30Days = int.Parse(Console.ReadLine());
- double myProductionFor30days = 0;
- double dailyProduction = Math.Floor((double)biscuitsPerDayPerWorker * countOfWorkers);//must add Math.Floor in the beginning for correct result
- double dailyProductionEveryThirdDay =Math.Floor((double) dailyProduction - (0.25 * dailyProduction));
- for (int day = 1; day <=30; day++)
- {
- if (day % 3 != 0)
- {
- myProductionFor30days += dailyProduction;
- }
- else if (day % 3 == 0)
- {
- myProductionFor30days += dailyProductionEveryThirdDay;
- }
- }
- Console.WriteLine($"You have produced {myProductionFor30days} biscuits for the past month.");
- if (myProductionFor30days > anotherFactoryProductionFor30Days)
- {
- Console.WriteLine($"You produce { Math.Floor(myProductionFor30days-anotherFactoryProductionFor30Days)/anotherFactoryProductionFor30Days*100:F2} percent more biscuits.");
- }
- else
- {
- Console.WriteLine($"You produce {Math.Floor(anotherFactoryProductionFor30Days-myProductionFor30days)/anotherFactoryProductionFor30Days*100:F2} percent less biscuits.");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment