My issue
Receiving mentioned error as “Time Limit Exceeded”, although the output is as per the requirements. I’m not sure why this issue is there.
My code
// Update the code below to solve this problem
#include <stdio.h>
#include <stdlib.h>
int main()
{
int t;
scanf("%d", &t);
while (t--)
{
int N, M;
scanf("%d %d", &N, &M);
int count = 0;
for (int i = 1; i<= (N<M ? N:M); i++)
{
if ((N%i == 0) && (M%i == 0))
{
count = i;
}
}
printf("%d \n", count);
}
return 0;
}
Learning course: C for problem solving - 2
Problem Link: CodeChef: Practical coding for everyone
