Advertisement
Spocoman

Spaceship

Nov 26th, 2021
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.97 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Spaceship
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double width = double.Parse(Console.ReadLine());
  10.             double length = double.Parse(Console.ReadLine());
  11.             double height = double.Parse(Console.ReadLine());
  12.             double averageHeight = double.Parse(Console.ReadLine());
  13.            
  14.             double spaceshipVolume = width * length * height;
  15.             double astronautVolume = (averageHeight + 0.4) * 2 * 2;
  16.             int team = (int)(spaceshipVolume / astronautVolume);
  17.  
  18.             if (team < 3)
  19.             {
  20.                 Console.WriteLine("The spacecraft is too small.");
  21.             }
  22.             else if (team > 10)
  23.             {
  24.                 Console.WriteLine("The spacecraft is too big.");
  25.             }
  26.             else
  27.             {
  28.                 Console.WriteLine($"The spacecraft holds {team} astronauts.");
  29.             }
  30.         }
  31.     }
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement