WAP to find the factors of a number
August 29, 2025
/*
* WAP to find the factors of a number
* e.g. 6 = 1,2,3,6
*/
* WAP to find the factors of a number
* e.g. 6 = 1,2,3,6
*/
import java.util.*;
class Code31
{
public static void main (String[] args)
{
int i,n;
Scanner sc = new Scanner(System.in);
System.out.println("Enter the number: ");
n = sc.nextInt();
i=1;
while(i<=n)
{
if(n%i==0)
{
System.out.print(i + " ");
}
i=i+1;
}
}
}