Skip to content

Instantly share code, notes, and snippets.

@markz0r
Created September 17, 2019 05:38
Show Gist options
  • Save markz0r/9a0fca5bccd6f47856dbd1c65dc9ec8f to your computer and use it in GitHub Desktop.
Save markz0r/9a0fca5bccd6f47856dbd1c65dc9ec8f to your computer and use it in GitHub Desktop.
import java.util.Scanner;
public class PrFa {
public static void main(String args[]){
int number;
Scanner sc = new Scanner(System.in);
System.out.println("Enter a number ::");
number = sc.nextInt();
for(int i = 2; i< number; i++) {
while(number%i == 0) {
System.out.println(i+" ");
number = number/i;
}
}
if(number >2) {
System.out.println(number);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment