- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# 10’s Complement of a decimal number?

**9’s complement** and **10’s complement** are used to make the arithmetic operations in digital system easier. These are used to make computational operations easier using complement implementation and usually trade hardware usage to the program.

To obtain the 9’s complement of any number we have to subtract the number with (10^{n} – 1) where n = number of digits in the number, or in a simpler manner we have to subtract each digit of the given decimal number from 9.

**10’s complement**, it is relatively easy to find out the 10’s complement after finding out the 9’s complement of that number. We have to add 1 with the **9’s complement** of any number to obtain the desired 10’s complement of that number. Or if we want to find out the 10’s complement directly, we can do it by following the following formula, (10^{n} – number), where n = number of digits in the number.

Let us take a decimal number 456, 9’s complement of this number will be

999 -456 _____ 543

10’s complement of this no

543 (+)1 ______ 544

Input:456 Output:544

## Explanation

Mathematically,

10’s complement = 9’s complement + 1 10’s complement = 10i – num

Where, i = total number of digits in num.

## Example

#include <iostream> #include<math.h> using namespace std; int main() { int i=0,temp,comp,n; n=456; temp = n; while(temp!=0) { i++; temp=temp/10; } comp = pow(10,i) - n; cout<<comp; return 0; }

- Related Questions & Answers
- 1’s and 2’s complement of a Binary Number?
- One’s Complement
- Two’s Complement
- Draw a Turing machine to find 1’s complement of a binary number
- Draw a Turing machine to find 2’s complement of a binary number
- Previous number same as 1’s complement in C++
- C Program to find two’s complement for a given number
- Find One’s Complement of an Integer in C++
- Complement of Base 10 Integer in Python
- 1's Complement vs 2's Complement
- Design a Moore machine to generate 1's complement of a binary number.
- Design a TM for an equal number of a’s and b’s must follow a
- How to use JavaScript to check if a number has a decimal place or it’s a whole number?
- 1's complement notation
- 2's complement notation