Zhaniartt

Untitled

Nov 25th, 2018
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.16 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp30
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double widthSpaceship = double.Parse(Console.ReadLine());
  14.             double lengthSpaceship = double.Parse(Console.ReadLine());
  15.             double highSpaceship = double.Parse(Console.ReadLine());
  16.             double highAustronafts = double.Parse(Console.ReadLine());
  17.  
  18.             double totalSpaceship = widthSpaceship * lengthSpaceship * highSpaceship;
  19.             double roomSpace = (highAustronafts + 0.40) * 2 * 2;
  20.             double space = Math.Floor(totalSpaceship / roomSpace);
  21.             if (space >= 3 && space <= 10)
  22.             {
  23.                 Console.WriteLine($"The spacecraft holds {Math.Floor(space)} astronauts.");
  24.  
  25.             }
  26.             else if (space < 3)
  27.             {
  28.                 Console.WriteLine("The spacecraft is too small.");
  29.             }
  30.             else if (space > 10)
  31.             {
  32.                 Console.WriteLine("The spacecraft is too big.");
  33.             }
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment