Project Euler #5: Smallest multiple - Hacker Rank Program

Problem Statement
This problem is a programming version of Problem 5 from projecteuler.net
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
What is the smallest positive number that is evenly divisible(divisible with no remainder) by all of the numbers from 1 to 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.

Constraints 1T10 1N40
Sample Input
2
3
10
Sample Output
6
2520
 
MY SOLUTION:
 #include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

int fact(int n)
  {
  int min=1,i,j,a[n];
    for(i=0;i<n;i++)
        a[i]=i+1;
    for(i=0;i<n-1;i++)
        {
        for(j=i+1;j<n;j++){
            if((a[j]%a[i])==0)
                a[j]=a[j]/a[i];
        }
        min*=a[i];
    }
    
return min*a[n-1];    
}
int main() {

    int t;
    scanf("%d",&t);
    while(t--)
    {
        int n;
        scanf("%d",&n);
   printf("%d\n",fact(n));
              }
             
                     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...