forked from Annex5061/java-algorithms
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAllFactors.java
More file actions
Latest commit
27 lines (23 loc) · 568 Bytes
/
Copy pathAllFactors.java
File metadata and controls
27 lines (23 loc) · 568 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
importjava.util.*;
publicclassAllFactors
{
publicstaticvoidmain(String[] args)
{
System.out.print("Enter a Number : ");
Scannersc = newScanner(System.in);
intnum = sc.nextInt();
booleanflag = false;
for(inti=2; i<num; i++)
{
if(num%i==0)
{
flag = true;
System.out.print(i+" ");
}
}
if(!flag)
{
System.out.print("This no. has no factors.");
}
}
}