Write a program in java to input an integer and print it's factors
Answers
Answered by
2
Answer:
hello world is the integer which can be used to print its as a factor
Answered by
6
public class Factors {
public static void main(String[] args) {
int number = 60;
System.out.print("Factors of " + number + " are: ");
for(int i = 1; i <= number; ++i) {
if (number % i == 0) {
System.out.print(i + " ");
}
}
}
}
Similar questions
English,
5 months ago
English,
5 months ago
Math,
5 months ago
English,
11 months ago
Social Sciences,
1 year ago