Home > Back-end >  The bosses know this how to write?
The bosses know this how to write?

Time:12-13

CodePudding user response:

 # include & lt; stdio.h> 
#include

Int is_prime (int n)
{
Int I, size;

If (n & lt; 2)
return 0;
Size=(int) SQRT (n);

For (I=2; I & lt; size; I++)
If I (n %==0)
return 0;

return 1;
}

The static void swap (int * a, int * b)
{
Int TMP=* a;
*=* b;
* b=TMP;
}

Int check_revesible_prime (int n)
{
Int TMP.

If (n & lt; 10)
return 1;

TMP=0;
While (n) {
TMP=(n % 10) + TMP * 10;
N/a=10;
}

If (is_prime (TMP))
return 1;

return 0;
}

Int main (void)
{
int m, n;
Int I, CNT=0;

The scanf (" % d % d ", & amp; M, & amp; N);
If (m & gt; N)
Swap (& amp; M, & amp; N);

For (I=m; I & lt;=n; I++) {
{if (is_prime (I))
{if (check_revesible_prime (I))
Printf (" % d ", I);
cnt++;
}
If (% CNT==0 8)
Putchar (10);
}

}
Putchar (10);

return 0;
}

For your reference ~

For code is not a good habit and solution to the problem, still want the building to write, see for yourself at least judgment logic of prime Numbers you can write about or look online to learn at least, doing nothing at all what you want to learn? In time or is hard to learn, or what can you learn in university?
  • Related