Skip to content
Programmingoneonone
Programmingoneonone
  • Home
  • CS Subjects
    • IoT – Internet of Things
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
Programmingoneonone

HackerEarth Supernatural problem solution

YASH PAL, 31 July 2024
In this HackerEarth Supernatural problem solution, you are given a number n. A supernatural number is a number whose product of digits is equal to n, and in this number, there is no digit 1. Count the number of supernatural numbers for a given n.
HackerEarth Supernatural problem solution

HackerEarth Supernatural problem solution.

#include<bits/stdc++.h>
using namespace std;
int main(){

int n;
int ans = 0;

cin >> n;
for(int i = 1; i <= 1000000; ++i){
int j = i;
int mul = 1;
bool f = 1;
while(j){
int val = j % 10;
if(val < 2){
f = 0;
break;
}else {
mul *= val;
}
j /= 10;
}
if(mul == n && f)++ans;
}

cout << ans << 'n';

return 0;
}
coding problems

Post navigation

Previous post
Next post
  • How AI Is Revolutionizing Personalized Learning in Schools
  • GTA 5 is the Game of the Year for 2024 and 2025
  • Hackerrank Day 5 loops 30 days of code solution
  • Hackerrank Day 6 Lets Review 30 days of code solution
  • Hackerrank Day 14 scope 30 days of code solution
©2025 Programmingoneonone | WordPress Theme by SuperbThemes