Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class MultiplicationSign
- {
- private static int GetInt(string intName)
- {
- while (true)
- {
- Console.Write("Enter " + intName + ": ");
- string str = Console.ReadLine();
- int i;
- bool isSuccessful = int.TryParse(str, out i);
- if (isSuccessful)
- return i;
- }
- }
- static void Main(string[] args)
- {
- int a = GetInt("a");
- int b = GetInt("b");
- int c = GetInt("c");
- if ( (a & (b & c)) == 0) {
- Console.WriteLine("0");
- }
- else if (((a ^ (b ^ c)) < 0) ||
- ((b ^ (a ^ c)) < 0) ||
- ((c ^ (a ^ b)) < 0)) {
- Console.WriteLine("-");
- }
- else {
- Console.WriteLine("+");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement