Advertisement
elena1234

GiftboxCoverage

Oct 13th, 2020
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.06 KB | None | 0 0
  1. using System;
  2.  
  3. namespace GiftboxCoverage
  4. {
  5.     class MainClass
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.             double sizeOfBoxSide = double.Parse(Console.ReadLine());
  10.             int allSheetsOfPaper = int.Parse(Console.ReadLine());
  11.             double areaCoveredBySingleNormalSheet = double.Parse(Console.ReadLine());
  12.             double areaCoveredByEveryThirdSheet = 0.25 * areaCoveredBySingleNormalSheet;
  13.             double numberOfEveryThirdSheet = Math.Truncate((double)allSheetsOfPaper / 3);
  14.             double numberOfEveryNormalSheet = allSheetsOfPaper - numberOfEveryThirdSheet;
  15.             double areaCoveredWithAllSheets = (numberOfEveryNormalSheet * areaCoveredBySingleNormalSheet) + (numberOfEveryThirdSheet * areaCoveredByEveryThirdSheet);
  16.  
  17.             double areaOfGiftBox = sizeOfBoxSide * sizeOfBoxSide*6;
  18.             double percentageAllSheetsCovered = areaCoveredWithAllSheets / areaOfGiftBox * 100;
  19.             Console.WriteLine($"You can cover {percentageAllSheetsCovered:F2}% of the box.");
  20.         }
  21.       }
  22.     }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement