Quotes help make search much faster. Example: "Practice Makes Perfect"

Tuesday, September 3, 2019

Codecademy Comparison Operators 3/6


// Sample Solution
using System;

namespace ComparisonOperators
{
  class Program
  {
    static void Main(string[] args)
    {
      double timeToDinner = 4; //6 pm - 2 pm
double rate = 30; //miles per hour
double distance = 95; //miles
      double tripDuration = distance / rate; //hours
      //double timeToDinner = Math.Ceiling(time);
      Console.WriteLine(tripDuration);
      bool answer = tripDuration <= timeToDinner;
      Console.WriteLine(answer);
      if(answer){
        Console.WriteLine("Yes, we will arrive before dinner begins!");
      } else {
        Console.WriteLine("No, we will be late for dinner.");
      }
    }
  }
}

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts