Monday, March 21, 2016

Exercise 3: Numbers and Math

Exercise 3: Numbers and Math

inspired by  http://learnpythonthehardway.org/book/ex3.html

using System;

public class Test
{
     public static void Main()
     {
          Console.WriteLine("I will now count my chickens:");

          Console.WriteLine("Hens"+ (26 + 30 / 5) );
          Console.WriteLine("Roosters"+ (100 - 25 * 3 % 4) );

          Console.WriteLine("Now I will count the eggs:");

          Console.WriteLine(3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6);

          Console.WriteLine("Is it true that 3 + 2 < 5 - 7?");
          Console.WriteLine(3 + 2 < 5 - 7);

          Console.WriteLine("What is 3 + 2? "+ (3 + 2) );
          Console.WriteLine("What is 5 - 7? "+ (5 - 7) );

          Console.WriteLine("Oh, that's why it's False.");
          Console.WriteLine("How about some more.");

          Console.WriteLine("Is it greater?"+ (5 > -2) );
          Console.WriteLine("Is it greater or equal?"+ (5 >= -2) );
          Console.WriteLine("Is it less or equal?"+ (5 <= -2) );
     }
}

No comments:

Post a Comment