Answers for "humble number in java code"

0

humble number in java code

import java.util.HashSet;
public class Main
{
	public static void main(String[] args) {
		int n = 21;
		humble(n);
	}
	public static void humble(int n){
	    HashSet<Integer> h = new HashSet<>() ;
	    for(int i=2;i<=n;i++){
	        while(n%i == 0){
	            h.add(i);
	            n = n/i;
	            if(i != 2 && i != 3 && i!=5 && i!=7 ){
	                System.out.print("not ");
	            }
	        }
	    }
	    System.out.println("humble");
	}
}
Posted by: Guest on August-27-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language