# Java Program to Find Factors of a Number

Java Program to Find Factors of a Number. A factor is a number that divides another number perfectly, leaving no residue. The number of factors in most numbers is even; however, the number of factors in a square number is odd. There are just two elements in a prime number: the number itself and 1.

`public class Main {public static void main(String[] args){int number = 5;System.out.print("Factors of " + number + " is ");for (int i = 1; i <= number; ++i) {if (number % i == 0) {System.out.print(i + " ");}}}}`

Output:

Factors of 5 are: 1 5

## What is Entry Controlled Loop in Java

In Java, the “for” loop is an entry-controlled loop that allows a user to iteratively run a block of statement(s) for a set number of times. The test-condition specified inside the “for” loop determines the number of iterations. The Java “for” loop is one of the most simple Java loops to grasp. Java Program to Find Factors of a Number to entry controlled loop in java.

## What is If Else Statement in Java

In Java, the if statement is used to execute a block of code if a condition is true. If a condition evaluates to false, the if else statement is used alongside an if statement to run code. The if else if statement is also used to test multiple conditions. Java Program to Find Factors of a Number Using this program we can find factor of number in programming.

## Java Program to Find Factors of a Number for Programming

A factor is a number that divides another number perfectly, leaving no residue. The number of factors in most numbers is even; however, the number of factors in a square number is odd. There are just two elements in a prime number: the number itself and 1.

A factor is a number that divides a given number completely without leaving any remainder. A number’s factors are numbers or algebraic expressions that divide a given number or expression evenly. A number’s factors can be either positive or negative. Java Program to Find Factors of a Number for beginners to understand the programming.

## What is % Percentage in Java Program

Percentage — %, In the body of a program, the percent sign is most commonly used to indicate nonexecutable text. Normally, this text is used to include comments in your code.