Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _05._Multiplication_Sign
- {
- class Program
- {
- static void Main(string[] args)
- {
- double num1 = double.Parse(Console.ReadLine());
- double num2 = double.Parse(Console.ReadLine());
- double num3 = double.Parse(Console.ReadLine());
- Console.WriteLine(CheckMultiplyResult(num1, num2, num3));
- }
- private static string CheckMultiplyResult(double num1, double num2, double num3)
- {
- double[] arr = { num1, num2, num3 };
- string result;
- int negativeCounter = 0;
- bool zero = false;
- for (int i = 0; i < 3; i++)
- {
- if (arr[i] == 0)
- {
- zero = true;
- }
- else if (arr[i] < 0)
- {
- negativeCounter++;
- }
- }
- if (zero)
- {
- result = "zero";
- }
- else if (negativeCounter % 2 != 0)
- {
- result = "negative";
- }
- else
- {
- result = "positive";
- }
- return result;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement