Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Problem 4.Multiplication Sign
- //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.
- using System;
- class MultiplicationSign
- {
- static void Main()
- {
- Console.Write("Please, enter a:");
- double a = double.Parse(Console.ReadLine());
- Console.Write("Please, enter b:");
- double b = double.Parse(Console.ReadLine());
- Console.Write("Please, enter c:");
- double c = double.Parse(Console.ReadLine());
- double result = a * b * c;
- if (result > 0)
- {
- Console.WriteLine("Result: +");
- }
- else if (result < 0)
- {
- Console.WriteLine("Result: -");
- }
- else
- {
- Console.WriteLine("Result: 0");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement