We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Algorithms
- Implementation
- Find Digits
- Discussions
Find Digits
Find Digits
Sort by
recency
|
1663 Discussions
|
Please Login in order to post a comment
Here is my Python solution using list comprehensions! The first list is all the digits that are not 0, and the second list is all the numbers in that list that evenly divide the number. We then return the length of that list, which is the amount of numbers that work.
C#
Finding the right digits can sometimes be tricky, but it’s always a rewarding challenge. By the way, if you're interested in boosting your workplace's safety standards, check out ISO 45001 Occupational Health and Safety Management System – Training Courses. It’s a fantastic way to ensure a safer, healthier environment for everyone involved!
My python answer: def findDigits(n): # Write your code here num_string = str(n) div = 0 for i in range(len(num_string)): if int(num_string[i]) == 0: continue elif n % int(num_string[i]) == 0: div += 1 return div
java15:
import java.util.*;
public class Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int number; String napis; int divDigit=0;