Advertisement
ralichka

Exam-30.06.2019-01.GiftboxCoverage

Oct 30th, 2019
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.92 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _01.GiftboxCoverage
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double size = double.Parse(Console.ReadLine());
  10.             int sheets = int.Parse(Console.ReadLine());
  11.             double coveredAreaPerSheet = double.Parse(Console.ReadLine());
  12.             double totalCoveredArea = 0;
  13.  
  14.             double areaBox = size * size * 6;
  15.             for (int i = 1; i <= sheets; i++)
  16.             {
  17.                 if (i % 3 == 0)
  18.                 {
  19.                     totalCoveredArea += coveredAreaPerSheet * 0.25;
  20.  
  21.                 }
  22.                 else
  23.                 {
  24.                     totalCoveredArea += coveredAreaPerSheet;
  25.  
  26.                 }
  27.  
  28.             }
  29.  
  30.  
  31.             double percentage = totalCoveredArea / areaBox * 100;
  32.  
  33.             Console.WriteLine($"You can cover {percentage:f2}% of the box.");
  34.  
  35.  
  36.  
  37.  
  38.  
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement