Write a program in java
to enter a number and print its factors
Answers
Answered by
1
Answer:
You can find your Brainly profile link by clicking on your profile picture in the upper right corner. Once you click on your ...
Top answer ·
Answered by
1
import java.util.*;
public class Q3
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter a number");
int d,n;
n=sc.nextInt();
System.out.println("Enter a number");
for(d=n; d>=1; d--)
{
if(n%d==0)
System.out.println(d+"");
}
}
}Answer:
Explanation:
Similar questions
Math,
1 month ago
Math,
1 month ago
Science,
2 months ago
Social Sciences,
2 months ago
Math,
9 months ago