# C program to check number is self-descriptive number or not.

### Problem statement

This program take any number from user and check it is self-descriptive number or not.

### What is self-descriptive number?

A number is called as self-descriptive when the position of digit represents the number of time it appears in that number.
There are so many numbers are self-descriptive.
For example:

Consider 2020,

• position 0 has value 2 and there are two 0s in the number;
• position 1 has value 0 and there are no 1s in the number;
• position 2 has value 2 and there are two 2s in the number;
• position 3 has value 0 and there are zero 3s in the number.

Now consider a self-descriptive number 6210001000,

• contains 6 at position 0, indicating that there are six 0s in 6210001000;
• It contains 2 at position 1, indicating that there are two 1s in 6210001000;
• It contains 1 at position 2, indicating that there is one 2 in 6210001000;
• It contains 0 at position 3, indicating that there is no 3 in 6210001000;
• It contains 0 at position 4, indicating that there is no 4 in 6210001000;
• It contains 0 at position 5, indicating that there is no 5 in 6210001000;
• It contains 1 at position 6, indicating that there is one 6 in 6210001000;
• It contains 0 at position 7, indicating that there is no 7 in 6210001000;
• It contains 0 at position 8, indicating that there is no 8 in 6210001000;
• It contains 0 at position 9, indicating that there is no 9 in 6210001000.

### Program

Output

Help others by sharing the content!

This site uses Akismet to reduce spam. Learn how your comment data is processed.