# Print all factors of number in pair

Here given code implementation process.

``````// C Program
// Print all factors of number in pair
#include <stdio.h>

// Find all the factor pair of a number
void factorPairs(int num)
{
printf("\n Factors pair of a number %d is \n", num);
// Execute loop through by 1 to num/2
for (int i = 1; i <= num / 2; ++i)
{
if (num % i == 0)
{
// When get resultant pair
printf(" (%d X %d) \n", i, num / i);
}
}
}
int main()
{
// Test Case
factorPairs(136);
factorPairs(760);
factorPairs(22);
factorPairs(23);
return 0;
}``````

#### Output

`````` Factors pair of a number 136 is
(1 X 136)
(2 X 68)
(4 X 34)
(8 X 17)
(17 X 8)
(34 X 4)
(68 X 2)

Factors pair of a number 760 is
(1 X 760)
(2 X 380)
(4 X 190)
(5 X 152)
(8 X 95)
(10 X 76)
(19 X 40)
(20 X 38)
(38 X 20)
(40 X 19)
(76 X 10)
(95 X 8)
(152 X 5)
(190 X 4)
(380 X 2)

Factors pair of a number 22 is
(1 X 22)
(2 X 11)
(11 X 2)

Factors pair of a number 23 is
(1 X 23)``````
``````/*
Java Program
Print all factors of number in pair
*/
public class Factorization
{
// Find all the factor pair of a number
public void factorPairs(int num)
{
System.out.print("\n Factors pair of a number " + num + " is \n");
// Execute loop through by 1 to num/2
for (int i = 1; i <= num / 2; ++i)
{
if (num % i == 0)
{
// When get resultant pair
System.out.print(" (" + i + " X " + num / i + ") \n");
}
}
}
public static void main(String[] args)
{
// Test Case
}
}``````

#### Output

`````` Factors pair of a number 136 is
(1 X 136)
(2 X 68)
(4 X 34)
(8 X 17)
(17 X 8)
(34 X 4)
(68 X 2)

Factors pair of a number 760 is
(1 X 760)
(2 X 380)
(4 X 190)
(5 X 152)
(8 X 95)
(10 X 76)
(19 X 40)
(20 X 38)
(38 X 20)
(40 X 19)
(76 X 10)
(95 X 8)
(152 X 5)
(190 X 4)
(380 X 2)

Factors pair of a number 22 is
(1 X 22)
(2 X 11)
(11 X 2)

Factors pair of a number 23 is
(1 X 23)``````
``````// Include header file
#include <iostream>

using namespace std;
/*
C++ Program
Print all factors of number in pair
*/
class Factorization
{
public:
// Find all the factor pair of a number
void factorPairs(int num)
{
cout << "\n Factors pair of a number " << num << " is \n";
// Execute loop through by 1 to num/2
for (int i = 1; i <= num / 2; ++i)
{
if (num % i == 0)
{
// When get resultant pair
cout << " (" << i << " X " << num / i << ") \n";
}
}
}
};
int main()
{
// Test Case
return 0;
}``````

#### Output

`````` Factors pair of a number 136 is
(1 X 136)
(2 X 68)
(4 X 34)
(8 X 17)
(17 X 8)
(34 X 4)
(68 X 2)

Factors pair of a number 760 is
(1 X 760)
(2 X 380)
(4 X 190)
(5 X 152)
(8 X 95)
(10 X 76)
(19 X 40)
(20 X 38)
(38 X 20)
(40 X 19)
(76 X 10)
(95 X 8)
(152 X 5)
(190 X 4)
(380 X 2)

Factors pair of a number 22 is
(1 X 22)
(2 X 11)
(11 X 2)

Factors pair of a number 23 is
(1 X 23)``````
``````// Include namespace system
using System;
/*
C# Program
Print all factors of number in pair
*/
public class Factorization
{
// Find all the factor pair of a number
public void factorPairs(int num)
{
Console.Write("\n Factors pair of a number " + num + " is \n");
// Execute loop through by 1 to num/2
for (int i = 1; i <= num / 2; ++i)
{
if (num % i == 0)
{
// When get resultant pair
Console.Write(" (" + i + " X " + num / i + ") \n");
}
}
}
public static void Main(String[] args)
{
// Test Case
}
}``````

#### Output

`````` Factors pair of a number 136 is
(1 X 136)
(2 X 68)
(4 X 34)
(8 X 17)
(17 X 8)
(34 X 4)
(68 X 2)

Factors pair of a number 760 is
(1 X 760)
(2 X 380)
(4 X 190)
(5 X 152)
(8 X 95)
(10 X 76)
(19 X 40)
(20 X 38)
(38 X 20)
(40 X 19)
(76 X 10)
(95 X 8)
(152 X 5)
(190 X 4)
(380 X 2)

Factors pair of a number 22 is
(1 X 22)
(2 X 11)
(11 X 2)

Factors pair of a number 23 is
(1 X 23)``````
``````<?php
/*
Php Program
Print all factors of number in pair
*/
class Factorization
{
// Find all the factor pair of a number
public	function factorPairs(\$num)
{
echo "\n Factors pair of a number ". \$num ." is \n";
// Execute loop through by 1 to num/2
for (\$i = 1; \$i <= intval(\$num / 2); ++\$i)
{
if (\$num % \$i == 0)
{
// When get resultant pair
echo " (". \$i ." X ". intval(\$num / \$i) .") \n";
}
}
}
}

function main()
{
// Test Case
}
main();``````

#### Output

`````` Factors pair of a number 136 is
(1 X 136)
(2 X 68)
(4 X 34)
(8 X 17)
(17 X 8)
(34 X 4)
(68 X 2)

Factors pair of a number 760 is
(1 X 760)
(2 X 380)
(4 X 190)
(5 X 152)
(8 X 95)
(10 X 76)
(19 X 40)
(20 X 38)
(38 X 20)
(40 X 19)
(76 X 10)
(95 X 8)
(152 X 5)
(190 X 4)
(380 X 2)

Factors pair of a number 22 is
(1 X 22)
(2 X 11)
(11 X 2)

Factors pair of a number 23 is
(1 X 23)``````
``````/*
Node Js Program
Print all factors of number in pair
*/
class Factorization
{
// Find all the factor pair of a number
factorPairs(num)
{
process.stdout.write("\n Factors pair of a number " + num + " is \n");
// Execute loop through by 1 to num/2
for (var i = 1; i <= parseInt(num / 2); ++i)
{
if (num % i == 0)
{
// When get resultant pair
process.stdout.write(" (" + i + " X " + parseInt(num / i) + ") \n");
}
}
}
}

function main()
{
// Test Case
}
main();``````

#### Output

`````` Factors pair of a number 136 is
(1 X 136)
(2 X 68)
(4 X 34)
(8 X 17)
(17 X 8)
(34 X 4)
(68 X 2)

Factors pair of a number 760 is
(1 X 760)
(2 X 380)
(4 X 190)
(5 X 152)
(8 X 95)
(10 X 76)
(19 X 40)
(20 X 38)
(38 X 20)
(40 X 19)
(76 X 10)
(95 X 8)
(152 X 5)
(190 X 4)
(380 X 2)

Factors pair of a number 22 is
(1 X 22)
(2 X 11)
(11 X 2)

Factors pair of a number 23 is
(1 X 23)``````
``````#  Python 3 Program
#  Print all factors of number in pair

class Factorization :
#  Find all the factor pair of a number
def factorPairs(self, num) :
print("\n Factors pair of a number ", num ," is ")
i = 1
#  Execute loop through by 1 to num/2
while (i <= int(num / 2)) :
if (num % i == 0) :
#  When get resultant pair
print(" (", i ," X ", int(num / i) ,") ")

i += 1

def main() :
#  Test Case

if __name__ == "__main__": main()``````

#### Output

`````` Factors pair of a number  136  is
( 1  X  136 )
( 2  X  68 )
( 4  X  34 )
( 8  X  17 )
( 17  X  8 )
( 34  X  4 )
( 68  X  2 )

Factors pair of a number  760  is
( 1  X  760 )
( 2  X  380 )
( 4  X  190 )
( 5  X  152 )
( 8  X  95 )
( 10  X  76 )
( 19  X  40 )
( 20  X  38 )
( 38  X  20 )
( 40  X  19 )
( 76  X  10 )
( 95  X  8 )
( 152  X  5 )
( 190  X  4 )
( 380  X  2 )

Factors pair of a number  22  is
( 1  X  22 )
( 2  X  11 )
( 11  X  2 )

Factors pair of a number  23  is
( 1  X  23 )``````
``````#  Ruby Program
#  Print all factors of number in pair

class Factorization
#  Find all the factor pair of a number
def factorPairs(num)
print("\n Factors pair of a number ", num ," is \n")
i = 1
#  Execute loop through by 1 to num/2
while (i <= num / 2)
if (num % i == 0)
#  When get resultant pair
print(" (", i ," X ", num / i ,") \n")
end

i += 1
end

end

end

def main()
#  Test Case
end

main()``````

#### Output

`````` Factors pair of a number 136 is
(1 X 136)
(2 X 68)
(4 X 34)
(8 X 17)
(17 X 8)
(34 X 4)
(68 X 2)

Factors pair of a number 760 is
(1 X 760)
(2 X 380)
(4 X 190)
(5 X 152)
(8 X 95)
(10 X 76)
(19 X 40)
(20 X 38)
(38 X 20)
(40 X 19)
(76 X 10)
(95 X 8)
(152 X 5)
(190 X 4)
(380 X 2)

Factors pair of a number 22 is
(1 X 22)
(2 X 11)
(11 X 2)

Factors pair of a number 23 is
(1 X 23)
``````
``````/*
Scala Program
Print all factors of number in pair
*/
class Factorization
{
// Find all the factor pair of a number
def factorPairs(num: Int): Unit = {
print("\n Factors pair of a number " + num + " is \n");
var i: Int = 1;
// Execute loop through by 1 to num/2
while (i <= (num / 2).toInt)
{
if (num % i == 0)
{
// When get resultant pair
print(" (" + i + " X " + (num / i).toInt + ") \n");
}
i += 1;
}
}
}
object Main
{
def main(args: Array[String]): Unit = {
var task: Factorization = new Factorization();
// Test Case
}
}``````

#### Output

`````` Factors pair of a number 136 is
(1 X 136)
(2 X 68)
(4 X 34)
(8 X 17)
(17 X 8)
(34 X 4)
(68 X 2)

Factors pair of a number 760 is
(1 X 760)
(2 X 380)
(4 X 190)
(5 X 152)
(8 X 95)
(10 X 76)
(19 X 40)
(20 X 38)
(38 X 20)
(40 X 19)
(76 X 10)
(95 X 8)
(152 X 5)
(190 X 4)
(380 X 2)

Factors pair of a number 22 is
(1 X 22)
(2 X 11)
(11 X 2)

Factors pair of a number 23 is
(1 X 23)``````
``````/*
Swift 4 Program
Print all factors of number in pair
*/
class Factorization
{
// Find all the factor pair of a number
func factorPairs(_ num: Int)
{
print("\n Factors pair of a number ", num ," is ");
var i: Int = 1;
// Execute loop through by 1 to num/2
while (i <= num / 2)
{
if (num % i == 0)
{
// When get resultant pair
print(" (", i ," X ", num / i ,") ");
}
i += 1;
}
}
}
func main()
{
// Test Case
}
main();``````

#### Output

`````` Factors pair of a number  136  is
( 1  X  136 )
( 2  X  68 )
( 4  X  34 )
( 8  X  17 )
( 17  X  8 )
( 34  X  4 )
( 68  X  2 )

Factors pair of a number  760  is
( 1  X  760 )
( 2  X  380 )
( 4  X  190 )
( 5  X  152 )
( 8  X  95 )
( 10  X  76 )
( 19  X  40 )
( 20  X  38 )
( 38  X  20 )
( 40  X  19 )
( 76  X  10 )
( 95  X  8 )
( 152  X  5 )
( 190  X  4 )
( 380  X  2 )

Factors pair of a number  22  is
( 1  X  22 )
( 2  X  11 )
( 11  X  2 )

Factors pair of a number  23  is
( 1  X  23 )``````
``````/*
Kotlin Program
Print all factors of number in pair
*/
class Factorization
{
// Find all the factor pair of a number
fun factorPairs(num: Int): Unit
{
print("\n Factors pair of a number " + num + " is \n");
var i: Int = 1;
// Execute loop through by 1 to num/2
while (i <= num / 2)
{
if (num % i == 0)
{
// When get resultant pair
print(" (" + i + " X " + num / i + ") \n");
}
i += 1;
}
}
}
fun main(args: Array < String > ): Unit
{
// Test Case
}``````

#### Output

`````` Factors pair of a number 136 is
(1 X 136)
(2 X 68)
(4 X 34)
(8 X 17)
(17 X 8)
(34 X 4)
(68 X 2)

Factors pair of a number 760 is
(1 X 760)
(2 X 380)
(4 X 190)
(5 X 152)
(8 X 95)
(10 X 76)
(19 X 40)
(20 X 38)
(38 X 20)
(40 X 19)
(76 X 10)
(95 X 8)
(152 X 5)
(190 X 4)
(380 X 2)

Factors pair of a number 22 is
(1 X 22)
(2 X 11)
(11 X 2)

Factors pair of a number 23 is
(1 X 23)``````

## Comment

Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.