{"id":20471,"date":"2021-09-13T14:51:16","date_gmt":"2021-09-13T09:21:16","guid":{"rendered":"https:\/\/python-programs.com\/?p=20471"},"modified":"2021-11-22T18:36:20","modified_gmt":"2021-11-22T13:06:20","slug":"python-program-to-check-given-two-integers-have-opposite-signs","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-check-given-two-integers-have-opposite-signs\/","title":{"rendered":"Python Program to Check Given Two Integers have Opposite signs"},"content":{"rendered":"

In the previous article, we have discussed Python Program to Clear nth Bit of a Number<\/a><\/p>\n

Given two numbers the task is to check whether the given two numbers have opposite signs in Python.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given First Number =3\r\nGiven Second Number = -17<\/pre>\n

Output:<\/strong><\/p>\n

The given two numbers { 3 , -17 } have opposite signs<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given First Number =4\r\nGiven Second Number = 9<\/pre>\n

Output:<\/strong><\/p>\n

The given two numbers { 4 , 9 } have same signs<\/pre>\n

Program to Detect Given Two Integers have Opposite signs in Python<\/h2>\n

Below are the ways to check whether the given two numbers have opposite signs in Python:<\/p>\n