Advertisement
Valantina

Spaceship/SampleExam

Jun 12th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 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 hight = double.Parse(Console.ReadLine());
  12.             double average = double.Parse(Console.ReadLine());
  13.             double rocketVolume = width * length * hight;
  14.             double avg = 0.4;
  15.             double roomVolume = (average + avg) * 2 * 2;
  16.             double space = Math.Floor(rocketVolume / roomVolume);
  17.             if (space >= 3 && space <= 10)
  18.             {
  19.                 Console.WriteLine($"The spacecraft holds {space} astronauts.");
  20.             }
  21.             else if (space < 3)
  22.             {
  23.                 Console.WriteLine("The spacecraft is too small.");
  24.             }
  25.             else
  26.             {
  27.                 Console.WriteLine("The spacecraft is too big.");
  28.             }
  29.  
  30.  
  31.  
  32.  
  33.  
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement