## Lucky alive person in a circle | Set – 2

Given that N person (numbered 1 to N) standing as to form a circle. They all have the gun in their hand which is pointed… Read More »

## 2’s compliment for a givin string using XOR

Given a binary string, task is to convert this string in to two’s compliment with the help of XOR operator. Examples: Input : 00000101 Output… Read More »

## Complement of a number with any base b

One’s Complement of an Integer 1’s and 2’s complement of a Binary Number In this post, a general method of finding complement with any arbitrary… Read More »

## 10’s Complement of a decimal number

Given a decimal number N. The task is to find 10’s complement of the number N. Example: Input : 25 Output : 10’s complement is… Read More »

## Subtraction of two numbers using 2’s Complement

Given two numbers and . The task is to subtract from by using 2’s Complement method. Note: Negative numbers represented as 2’s Complement of Positive… Read More »

## 8085 programs to find 2’s compliment with carry | Set 2

Problem-1: Find 2’s compliment of an 8 bit number stored at address 2050. Result is stored at address 3050 and 3051. Starting address of program… Read More »

## Why are negative numbers stored as 2’s complement?

When doing addition/subtraction on binary numbers in other representations we need to apply different logics (circuits) to perform addition and subtraction. In 2s-complement representation, we… Read More »

## Check if bits in range L to R of two numbers are complement of each other or not

Given two non-negative numbers a and b and two values l and r. The problem is to check whether all bits at corresponding positions in… Read More »

## Interface 8255 with 8085 microprocessor for 1’s and 2’s complement of a number

Problem – Interface 8255 with 8085 microprocessor and write an assembly language program to display 99 in Port A, 1’s complement of 99 in Port… Read More »

## EnumSet complementOf() Method in Java

The java.util.EnumSet.complementOf(Enum_Set) method is used to create an EnumSet containing elements of the same type as that of the specified Enum_Set, with the values present… Read More »

## Previous number same as 1’s complement

Given a number check whether binary representation of its predecessor and its 1’s complement are same or not. Examples: Input : 14 Output : NO… Read More »

## 8085 program to find 2’s complement of the contents of Flag Register

Problem – Write an assembly language program in 8085 microprocessor to find 2’s complement of the contents of Flag Register. Example – Algorithm – Initialize… Read More »

## 8085 program to find 1’s and 2’s complement of 16-bit number

Prerequisite – 8085 program to find 1’s and 2’s complement of 8-bit number Problem – – Write a program to find 1’s and 2’s complement… Read More »

## 8085 program to find 1’s and 2’s complement of 8-bit number

Problem – Write a program to find 1’s and 2’s complement of 8-bit number where starting address is 2000 and the number is stored at… Read More »

## Find relative complement of two sorted arrays

Given two sorted arrays arr1 and arr2 of size m and n respectively. We need to find relative complement of two array i.e, arr1 –… Read More »