Advertisement
TzvetanIG

Multiplication Sign

Mar 20th, 2014
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.89 KB | None | 0 0
  1. using System;
  2.  
  3. class MultiplicationSign
  4. {
  5.     static void Main()
  6.     {
  7.         double firstNumber = double.Parse(Console.ReadLine());
  8.         double secondNumber = double.Parse(Console.ReadLine());
  9.         double thirdNumber = double.Parse(Console.ReadLine());
  10.         char sign = '0';
  11.  
  12.         if (firstNumber > 0)
  13.         {
  14.             sign = '+';
  15.         }
  16.         else
  17.         {
  18.             sign = '-';
  19.         }
  20.  
  21.         if (secondNumber > 0 ^ sign == '+')
  22.         {
  23.             sign = '-';
  24.         }
  25.         else
  26.         {
  27.             sign = '+';
  28.         }
  29.  
  30.         if (thirdNumber > 0 ^ sign == '+')
  31.         {
  32.             sign = '-';
  33.         }
  34.         else
  35.         {
  36.             sign = '+';
  37.         }
  38.  
  39.         if (firstNumber == 0 || secondNumber == 0 || thirdNumber == 0)
  40.         {
  41.             sign = '0';
  42.         }
  43.  
  44.         Console.WriteLine(sign);
  45.  
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement