Using sprintf() method🧵|| functions mania😵‍💫 || but Simple!
Intuition\nAt the starting of solve this problem, i thought i can done this problem without using any built-in functions.But it is more tideous, so that i used 
# Intuition\nAt the starting of solve this problem, i thought i can done this problem without using any built-in functions.But it is more tideous, so that i used the functions like sprintf(),strcat(),atoi().\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n1. Calculate `two_N` and `three_N`: The function calculates `two_N` and `three_N`, which are the results of multiplying the input `n` by 2 and 3, respectively.\n\n2. Convert integers to strings: Three character arrays `s0`, `s1`, and `s2` are used to store the string representations of `n`, `two_N`, and `three_N`, respectively. The `sprintf()` function is used to convert the integers into strings and store them in these arrays.\n\n3. Concatenate the strings: The strings `s1` and `s2` are concatenated using the `strcat()` function, resulting in a new string that contains the digits of `two_N` followed by the digits of `three_N`.\n\n4. Concatenate again and convert back to integer: The string `s1` (with digits of `two_N` and `three_N`) is then concatenated with the string `s0` (with digits of `n`). The resulting string is converted back to an integer using the `atoi()` function, and the result is stored in the `res` variable.\n\n5. Check for fascinating property: The code then iterates over digits from 1 to 9 (using the variable `i`). For each digit, it checks if it appears exactly once in the `res` integer. If it finds a digit that is not present or appears more than once, it returns `false`, indicating that `n` is not a fascinating number.\n\n6. Count fascinating digits: The code counts the number of digits that appear exactly once in `res` for all digits from 1 to 9. If all digits appear exactly once, the variable `num` is incremented.\n\n7. Check the final result: Finally, the code checks if `num` is equal to 9 (since there are 9 digits from 1 to 9). If `num` is equal to 9, it means all digits from 1 to 9 appear exactly once in the `res` integer, and the function returns `true`, indicating that `n` is a fascinating number. Otherwise, it returns `false`.\n\n\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(log n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n![images.jpg](https://assets.leetcode.com/users/images/adda409b-7631-401b-9ad3-8df3031280f3_1691399743.314916.jpeg)\n\n# Code\n```\nbool isFascinating(int n){\nint two_N=2*n;\nint three_N=3*n;\nchar s0[100],s1[50],s2[50];\nsprintf(s0,"%d",n); // sprintf() is used to assign number to char array[]\nsprintf(s1,"%d",two_N);\nsprintf(s2,"%d",three_N);\nstrcat(s1,s2); // concatenate the strings\nstrcat(s0,s1);\nint res=atoi(s0); // atoi() is used to convert the string respresentation to integer \nint rem,temp,num=0,count=0;\nfor(int i=1;i<=9;i++)\n{\nint temp=res;\nwhile(temp>0)\n{\n    rem=temp%10;\n    if(rem==0) return false;\n    else\n    {\n        if(rem==i) count++;\n    }\n    temp/=10;\n}\nif(count==1) num++;\ncount=0;\n}\nif(num==9) return true;\nelse return false;\n}\n\n```
['Math', 'String', 'C']