Created
October 15, 2014 10:49
-
-
Save IvanNikolov/c3e44de484093861b17b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
//Write a program that shows the sign (+, - or 0) | |
//of the product of three real numbers, | |
//without calculating it. Use a sequence of if operators. Examples: | |
//a b c result | |
//5 2 2 + | |
//-2 -2 1 + | |
//-2 4 3 - | |
//0 -2.5 4 0 | |
class MultiplicationSign | |
{ | |
static void Main() | |
{ | |
double a = double.Parse(Console.ReadLine()); | |
double b = double.Parse(Console.ReadLine()); | |
double c = double.Parse(Console.ReadLine()); | |
if (((a < 0 && b < 0) && (c > 0) || (a > 0 && b > 0) && (c > 0))) | |
{ | |
Console.WriteLine("+"); | |
} | |
else if (a == 0) | |
{ | |
Console.WriteLine("0"); | |
} | |
else | |
{ | |
Console.WriteLine("-"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment