Skip to content

Instantly share code, notes, and snippets.

@markz0r
Created September 17, 2019 05:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markz0r/e308510ecba2bb1fc816cedfeceb3efa to your computer and use it in GitHub Desktop.
Save markz0r/e308510ecba2bb1fc816cedfeceb3efa 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