...

/

Detect If Two Integers Have Opposite Signs

Detect If Two Integers Have Opposite Signs

In this lesson, we detect if two integers have different signs. Ignore the values of the inputs for this problem and focus on the signs.

Introduction

In this question, input two numbers and detect if they have opposite signs.

Problem statement

We need to write a program to detect if two input integers have opposite signs.

Input: a = 100, b = -1
 
Output: "Signs are opposite"
Input: a = 100, b = 501
 
Output: "Signs are not opposite."

Concept

We have already ...

Access this course and 1400+ top-rated courses and projects.