Advertisement
Spocoman

02. Product Sign

Oct 25th, 2023 (edited)
863
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int firstNumber, secondNumber, thirdNumber, negativeNumbers = 0;
  7.     cin >> firstNumber >> secondNumber >> thirdNumber;
  8.  
  9.     if (firstNumber < 0) {
  10.         negativeNumbers++;
  11.     }
  12.     if (secondNumber < 0) {
  13.         negativeNumbers++;
  14.     }
  15.     if (thirdNumber < 0) {
  16.         negativeNumbers++;
  17.     }
  18.  
  19.     if (negativeNumbers % 2 == 0 || (firstNumber == 0 || secondNumber == 0 || thirdNumber == 0)) {
  20.         cout << '+' << endl;
  21.     }
  22.     else {
  23.         cout << '-' << endl;
  24.     }
  25.  
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement