#include<stdio.h> #include<conio.h> void fibonacci ( int ); void primefibo ( int ); void main() { int n; printf("\n No. of Terms?:: "); scanf("%d",&n); fibonacci(n); printf("\n"); primefibo(n); } // Function for displaying Fibonacci Series void fibonacci(int n) { int i=2,t0=0,t1=1,tn=1; printf("\n SERIES :: "); printf("%d ",t0); while(i<n) { printf("%d ",tn); tn=t0+t1; t0=t1; t1=tn; i++; } printf("%d",tn); } // Function for displaying Prime Numbers from Fibonacci Series void primefibo ( int n ) { int i=2,t0=0,t1=1,tn=1; printf("\n Prime No. in SERIES :: "); while(i<n) { if(isprime(tn)) printf("%d ",tn); tn=t0+t1; t0=t1; t1=tn; i++; } if(isprime(tn)) printf("%d",tn); } // Function to check a number whether it is Prime or not int isprime( int n) { int i; if(i<=1) return 0; for(i=2;i<
আমার হিজিবিজি খাতা