Advertisement
Guest User

Multiplication Sign

a guest
Apr 5th, 2014
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 KB | None | 0 0
  1. using System;
  2.  
  3. class MultiplicationSign
  4. {
  5.     static void Main()
  6.     {
  7.         Console.WriteLine("Please enter three numbers:");
  8.         float numberA = float.Parse(Console.ReadLine());
  9.         float numberB = float.Parse(Console.ReadLine());
  10.         float numberC = float.Parse(Console.ReadLine());
  11.         bool isPositive = true;
  12.         if ((numberA == 0) || (numberB == 0) || (numberC == 0))
  13.         {
  14.             Console.WriteLine("0");
  15.         }
  16.         else
  17.         {
  18.             if (numberA < 0)
  19.             {
  20.                 isPositive = !isPositive;
  21.             }
  22.             if (numberB < 0)
  23.             {
  24.                 isPositive = !isPositive;
  25.             }
  26.             if (numberC < 0)
  27.             {
  28.                 isPositive = !isPositive;
  29.             }
  30.             if (isPositive)
  31.             {
  32.                 Console.WriteLine("+");
  33.             }
  34.             else
  35.             {
  36.                 Console.WriteLine("-");
  37.             }
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement