Write a program which takes a 9-digit number input from user, converts it into its reverse and then display one of the following statements: (
• Original number is x steps bigger (where x is the difference between the two) •
Reversed number is x steps bigger
• Both numbers are equal; hence it is a palindrome.
Here is program:
int main()
{
  int t, a, p;
  cin >> t;
  int* s = new int[t];
  for (int i = 0; i < t; i++)
  {
    cin >> p >> a;
    b = 1;
    while ((a * b - 1) % p != 0)
    {
      b++;
    }
    s[i] = b;
  }
  for (int i = 0; i < t; i++)
  cout << s[i] << endl;
}
Comments
Leave a comment