Project Euler #4: Largest palindrome product - Hacker Rank Program

Problem Statement
This problem is a programming version of Problem 4 from projecteuler.net
A palindromic number reads the same both ways. The smallest 6 digit palindrome made from the product of two 3-digit numbers is 101101=143×707.

Find the largest palindrome made from the product of two 3-digit numbers which is less than N.
Input Format
First line contains T that denotes the number of test cases. This is followed by T lines, each containing an integer, N.
Output Format
Print the required answer for each test case in a new line.
Constraints
1T100
101101<N<1000000
Sample Input
2
101110
800000
Sample Output
101101
793397

MY SOLUTION:
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

int palindrome(long int v)
{
   
 long int reverse,n,i,j;
    n=v;
    while (n != 0)
   {
      reverse = reverse * 10;
      reverse = reverse + n%10;
      n       = n/10;
   }
    if(reverse==v)
    {
     for(i=100;i<=999;i++)
         {
         for(j=100;j<=999;j++)
          {
           if(i*j==v)
               return 1;

         }
     }
        return 0;
    }
    else
        {
        return 0;
    }
}
int main() {

    int t;
    scanf("%d",&t);
    while(t--)
        {
        long int val;
        scanf("%ld",&val);
        int f=0;
        while(f==0)
            {
            f=palindrome(--val);
        }
        printf("%ld\n",val);
    }
    return 0;
}
 




Convert resultset object to list of map

Convert the resultset object to list of map In some cases, while we doing API automation, we need to fetch the value from the DB and hav...