Advertisement
RoshHoul

Task3 07

Sep 21st, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.07 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp1
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             var packageDemand = Convert.ToInt32(Console.ReadLine());
  10.             var boxSize = 320;
  11.             var stackSize = 8;
  12.  
  13.             int boxCount = 0;
  14.             int stackCount = 0;
  15.             int packageCount = 0;
  16.  
  17.             while (packageDemand > 0)
  18.             {
  19.                 if (packageDemand > boxSize)
  20.                 {
  21.                     boxCount = packageDemand / boxSize;
  22.                     packageDemand -= boxCount * boxSize;
  23.                 } else if (packageDemand > stackSize)
  24.                 {
  25.                     stackCount = packageDemand / stackSize;
  26.                     packageDemand -= stackCount * stackSize;
  27.                 } else
  28.                 {
  29.                     packageCount = packageDemand;
  30.                     packageDemand = 0;
  31.                 }
  32.             }
  33.  
  34.             Console.WriteLine(boxCount + " " + stackCount + " " +packageCount);
  35.             Console.ReadKey();
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement