Write a program to check whether the number is prime and also
check if it there i n fibonacci series, then return true
otherwise return false



Write a program to check whether the number is prime and also check if it there i n fibonacci ser..

Answer / surendra

include<stdio.h>
int main(){
int k,r;
long int i=0l,j=1,f;

//Taking maximum numbers form user
printf("Enter the number range:");
scanf("%d",&r);

printf("FIBONACCI SERIES: ");
printf("%ld %ld",i,j); //printing firts two values.

for(k=2;k<r;k++){
f=i+j;
i=j;
j=f;
printf(" %ld",j);
}

return 0;
}

Is This Answer Correct ?    3 Yes 4 No

Post New Answer

More C Code Interview Questions

main() { int i=5; printf("%d",++i++); }

1 Answers  


why array index always strats wuth zero?

2 Answers  


&#8206;#define good bad main() { int good=1; int bad=0; printf ("good is:%d",good); }

2 Answers  


Given n nodes. Find the number of different structural binary trees that can be formed using the nodes.

16 Answers   Aricent, Cisco, Directi, Qualcomm,


Print an integer using only putchar. Try doing it without using extra storage.

2 Answers  






main() { int i = 257; int *iPtr = &i; printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) ); }

1 Answers   CSC,


main() { int i=5; printf("%d%d%d%d%d%d",i++,i--,++i,--i,i); }

7 Answers  


void main() { unsigned giveit=-1; int gotit; printf("%u ",++giveit); printf("%u \n",gotit=--giveit); }

1 Answers  


main() { int c=- -2; printf("c=%d",c); }

1 Answers   TCS,


#include<stdio.h> void fun(int); int main() { int a; a=3; fun(a); printf("\n"); return 0; } void fun(int i) { if(n>0) { fun(--n); printf("%d",n); fun(--n); } } the answer is 0 1 2 0..someone explain how the code is executed..?

1 Answers   Wipro,


What is full form of PEPSI

0 Answers  


What is "far" and "near" pointers in "c"...?

3 Answers  


Categories