# Pair of Two digits Program in java

In this post, we will learn Pair of Two digits Program in java Programming language.

## Question:

Write a program that accepts a pair of two digit numbers which satisfies the following condition.

The product of the numbers should be the same, when both the numbers are reversed and multiplied.

If products were same,then print “Yes” else print “No”. Note: Assume both the inputs are 2-Digit values.

Hint: [13*62=31*26]

Sample Input:

13

62

Sample output:

Yes

### CODE:–

```import java.util.*;
public class Main
{
public static void main (String[] args) {
Scanner sc =new Scanner(System.in);
int a=sc.nextInt();
int b=sc.nextInt();
if(a>99||a<10||b>99||b<10)
{
System.out.println("No");
}
Main obj= new Main();
int ra=obj.rvs(a);
int rb=obj.rvs(b);
if(a*b==ra*rb)
{
System.out.println("Yes");
}
else
{
System.out.println("No");
}
}
int rvs(int num)
{
int r,rnum=0;
while (num>0)
{
r=num%10;
rnum=rnum*10+r;
num/=10;
}
return(rnum);
}
}```
Sharing Is Caring