Guest User

Untitled

a guest
May 23rd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. class Cubes
  5. {
  6.     static void Main(string[] args)
  7.     {
  8.         long[] arr = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
  9.  
  10.         decimal a = arr[0];
  11.         decimal b = arr[1];
  12.         decimal c = arr[2];
  13.  
  14.  
  15.         decimal BigBoxV = a * b * c;
  16.  
  17.        
  18.         decimal cubeSide = findGCD(c, findGCD(a, b));
  19.  
  20.         decimal cubeV = cubeSide * cubeSide * cubeSide;
  21.  
  22.         Console.WriteLine(Math.Round(BigBoxV / cubeV));
  23.     }
  24.  
  25.     public static decimal findGCD(decimal a, decimal b)
  26.     {
  27.  
  28.         if (b == 0)
  29.         {
  30.             return a;
  31.         }
  32.         else
  33.         {
  34.             return (findGCD(b, a % b));
  35.         }
  36.  
  37.     }
  38. }
Add Comment
Please, Sign In to add comment