code added
This commit is contained in:
parent
e9c131e299
commit
b84cdccee3
29
prim.c
Normal file
29
prim.c
Normal file
@ -0,0 +1,29 @@
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#define typ unsigned long long
|
||||
|
||||
|
||||
bool is_it_a_prim(typ* x){
|
||||
int k = 2;
|
||||
while(k < *x){
|
||||
if(*x % k == 0)
|
||||
return false;
|
||||
k++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int main(void){
|
||||
typ int fn = 0, fn_1 = 1, fn_2 = 0;
|
||||
for(int i=0;i<700;i++)
|
||||
{
|
||||
fn = fn_1 + fn_2;
|
||||
if(is_it_a_prim(&fn))
|
||||
printf("%llu\n",fn);
|
||||
fn_2 = fn_1;
|
||||
fn_1 = fn;
|
||||
}
|
||||
getchar();
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user