Write a C program to check whether the given number is ‘Fascinating number’ or not.

A Fascinating number is a number which when concatenated with its multiple of 2 and 3 together gives a number which contains all digits from 1 to 9 exactly once.

For example, consider 192

To concatenate, we first need to count the number of digits in the multiple of 2, then we multiply the original number with that much number of 10s and then we add the multiple of 2 to it.

We need to continue to concatenate multiple of 3 to the concatenated number.

To count the frequency of each digit in the concatenated number, we will use an array of size 10, in which each index will represent the digit and its value will be its count.


Note: Digit 0 is not considered while checking Fascinating number.

If you have any doubts or suggestion then comment below.

This Post Has 2 Comments

  1. Srikant kadgi

    Send full Program.

    1. Adarsh Kumar

      Program does not work for you?

Leave a Reply