Computer Science, asked by akshisaha06, 1 year ago

Write a program in JAVA to count the number of factors of a number .( which has to be entered by the user using SCANNER class)


Auror: can i write using
Auror: io
akshisaha06: Yaah sure !!!!
akshisaha06: I will be most thankful if you give the correct answer !!!!

Answers

Answered by p1998
1
package SimplerPrograms;

import java.util.Scanner;

public class FactorsOfNumberUsingFor {
private static Scanner sc;

public static void main(String[] args) {
int Number, i;
sc = new Scanner(System.in);

System.out.println("Please Enter any number to Find Factors: ");
Number = sc.nextInt();

for(i = 1; i <= Number; i++) {
if(Number%i == 0) {
System.out.format(" %d ", i);
}
}
}
}
Answered by anubhav093
1

Answer:

this is the answer

Explanation:

I hope it helps

Attachments:
Similar questions