inweb-bootstrap/Tests/Test Cases/_Tangled_Ideal/twinprimes.txt

34 lines
819 B
Text
Raw Normal View History

2019-02-04 22:26:45 +00:00
/* Tangled output generated by inweb: do not edit */
#include <stdio.h>
2020-04-15 22:45:08 +00:00
#define RANGE 100 /* the upper limit to the numbers we will consider */
2019-02-04 22:26:45 +00:00
#define TRUE 1
#define FALSE 0
2020-04-15 22:45:08 +00:00
#line 27 "inweb/Tests/Test Cases/twinprimes.inweb"
2019-02-04 22:26:45 +00:00
int main(int argc, char *argv[]) ;
2020-04-15 22:45:08 +00:00
#line 48 "inweb/Tests/Test Cases/twinprimes.inweb"
2019-02-04 22:26:45 +00:00
int isprime(int n) ;
2020-04-15 22:45:08 +00:00
#line 26 "inweb/Tests/Test Cases/twinprimes.inweb"
2019-02-04 22:26:45 +00:00
int main(int argc, char *argv[]) {
for (int i=1; i<RANGE; i++)
{
2020-04-15 22:45:08 +00:00
#line 33 "inweb/Tests/Test Cases/twinprimes.inweb"
2019-02-04 22:26:45 +00:00
if ((isprime(i)) && (isprime(i+2)))
printf("%d and %d\n", i, i+2);
}
2020-04-15 22:45:08 +00:00
#line 29 "inweb/Tests/Test Cases/twinprimes.inweb"
2019-02-04 22:26:45 +00:00
;
}
2020-04-15 22:45:08 +00:00
#line 48 "inweb/Tests/Test Cases/twinprimes.inweb"
2019-02-04 22:26:45 +00:00
int isprime(int n) {
if (n <= 1) return FALSE;
for (int m = 2; m*m <= n; m++)
if (n % m == 0)
return FALSE;
return TRUE;
}