import java.util.*; class factor { public static void main() { int n, i; Scanner sc=new Scanner(System.in); System.out.println(“Enter any number”); n=sc. ____1____ System.out.println(“The factors of a given number are”); for(i=1; i<=n; i++) { if(______2_____) System.out.print(_____3______+ “ , ”); } } }
Answers
Answered by
1
Answer:
import java.util.*;
class factor
{
public static void main()
{
int n, i;
Scanner sc=new Scanner(System.in); System.out.println(“Enter any number”);
n=sc.nextInt();
System.out.println(“The factors of a given number are”);
for(i=1; i<=n; i++)
{
if(n%i == 0)
System.out.print(i + “ , ”);
}
}
}
I hope you find it useful... If you have any query do comment, I will try to solve it...
Similar questions