using System; namespace CSharpPositiveOrNegative { class Program { static void Main(string[] args) { try { //Declaring the 3 integer variables int valueOne, valueTwo, valueThree; Console.WriteLine("Please Enter a whole number: "); valueOne = int.Parse(Console.ReadLine()); Console.WriteLine("Please Enter another whole number: "); valueTwo = int.Parse(Console.ReadLine()); //calculate the product of the 2 variables valueThree = valueOne * valueTwo; // Use the && operator to determine whether the two numbers are // both positive numbers - more than 0 //The product is positive only if the 2 numbers have the same sign if (valueOne > 0 && valueTwo > 0) { Console.WriteLine( "The answer is a Positive Number. The answer is: " + valueThree); // Use the && operator to determine whether the two numbers are // both negative numbers (less than 0) //If this condition is true the other "else if" are //dismissed without evaluating their conditions } else if (valueOne < 0 && valueTwo < 0) { Console.WriteLine( "The answer is a Positive Number. The answer is: " + valueThree); } // Use the OR operator to determine whether one of the numbers is // less than 0 else if (valueOne < 0 || valueTwo < 0) { //This condition is tested ONLY IF the above conditions are false Console.WriteLine( "The answer is a Negative Number. The answer is: " + valueThree); } else { Console.WriteLine( "Both numbers are not greater or less than 0"); } } catch (FormatException) { Console.WriteLine("You've entered a wrong formatted number"); } Console.WriteLine("\nPress any key to exit"); Console.Read(); } } }