Computer Science, asked by mehuleedas, 8 months ago

Write the Java Programming:- Input a number and print all the factors of the number.​

Answers

Answered by tseries12345678901
1

import java.util.Scanner;

public class Number {

public static void findFactor(int n) {

for(int i=1; i <= n; i++) {

if(n % i == 0)

System.out.print(i+"\t");

}

}

public static void main(String[] args) {

// declare variable

int number = 0;

// create Scanner class object

Scanner scan = new Scanner(System.in);

// take input

System.out.print("Enter a number:: ");

number = scan.nextInt();

// find the factor of the number

System.out.print("The factors are:: ");

findFactor(number);

// close Scanner class object

scan.close();

}

}

Hope it helped please mark me as the brainliest

Answered by vedantrpatil5050
0

Answer:

36562579641235897452

Similar questions