wildchild Posted January 4, 2011 Report Posted January 4, 2011 (edited) edit //Please lengthen your message to at least 10 characters. Edited January 5, 2011 by wildchild Quote
totti93 Posted January 4, 2011 Report Posted January 4, 2011 #include <stdio.h>#include <stdlib.h>int bf = 1;int cf = 2;int cn = 2;void fibo(int n){ int i, t; for (i = cn + 1; i <= n; i++){ t = cf; cf += bf; bf = t; } cn = n;}int isprime(int n){ int i; for (i = 2; i <= n / 2; i++){ if (n % i == 0) return 0; } return 1;}int main(void){ int i = 0, j = 0, n; printf("Cate numere prime din sirul lui Fibonacci doriti sa fie afisate="); scanf("%d", &n); if (n >= 0){ printf("%d\n", bf); j++; } while (j < n){ i++; fibo(i); if (isprime(cf)){ printf("%d\n", cf); j++; } } getch();} Quote
begood Posted January 4, 2011 Report Posted January 4, 2011 (edited) C | #include <stdio.h> #include <math.h> #include <c - Find primes smaller than 100, from the fibonacci sequencefacut in graba, fara sa-l testez.daca in while e 100, schimba cu n si citeste-l de la tastaturaLE: http://pastebin.com/8HVdK1AW Edited January 4, 2011 by begood Quote
totti93 Posted January 4, 2011 Report Posted January 4, 2011 hmm... da numerele s-ar putea sa fie cam mari deci am gresit la faptul ca le-am declarat ca "int" Quote
phreak Posted January 4, 2011 Report Posted January 4, 2011 pastebin e indexabil deci deja-i pe google. Quote
begood Posted January 4, 2011 Report Posted January 4, 2011 pastebin e indexabil deci deja-i pe google.und ? Quote
totti93 Posted January 4, 2011 Report Posted January 4, 2011 da chiar e:GoogleL.E. In plus si rstcenter.com e indexabil, deci tot nu-i bine... Quote
wildchild Posted January 4, 2011 Author Report Posted January 4, 2011 aia nu-i problema ca se sterge dupa post-ul si pe pastebin se modifica continutul.dupa aceea o sa mai stea putin in cache dupa care adio Quote