1 / 3
Aug 2023

#include<stdio.h>

int main()
{
int t, m, n, count=0;
printf(“Enter the number of test cases:”);
scanf("%d",&t);
while(t–)
{
printf(“Enter your numbers:\n”);
scanf("%d %d", &n, &m);
for(int i=n; i<=m; i++)
{
for(int j=1; j<=i; j++)
{
if(i%j == 0)
{
count++;
}
}
if(count == 2)
{
printf("%d\n", i);
}
count=0;
}
}
}

  • created

    Aug '23
  • last reply

    Aug '23
  • 2

    replies

  • 403

    views

  • 2

    users

SPOJ runs your code, gives it some input data and records the output. It then compares your output with the master output, and any differences will cause you to get Wrong Answer. So you need to make sure your output matches the expected output exactly.

So I gave your code the example input given in the problem, and it output this:

Enter the number of test cases:Enter your numbers:
2
3
5
7
Enter your numbers:
3
5

Instead of the expected:

2
3
5
7
3
5

Do you see the difference?