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

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

3 Answers  


main() { int i=-1,j=-1,k=0,l=2,m; m=i++&&j++&&k++||l++; printf("%d %d %d %d %d",i,j,k,l,m); }

1 Answers  


Is the following code legal? struct a { int x; struct a *b; }

2 Answers  


main() { clrscr(); } clrscr();

2 Answers  


main() { char a[4]="HELL"; printf("%s",a); }

3 Answers   Wipro,


main() { int i = 3; for (;i++=0;) printf(“%d”,i); }

1 Answers   CSC,


what is the output of following program ? void main() { int i=5; printf("%d %d %d %d %d ",i++,i--,++i,--i,i); }

10 Answers  


program to find the roots of a quadratic equation

14 Answers   College School Exams Tests, Engineering, HP, IIIT, Infosys, Rajiv Gandhi University of Knowledge Technologies RGUKT, SSC,


abcdedcba abc cba ab ba a a

2 Answers  


#include<stdio.h> main() { const int i=4; float j; j = ++i; printf("%d %f", i,++j); }

1 Answers  


#include<stdio.h> main() { FILE *ptr; char i; ptr=fopen("zzz.c","r"); while((i=fgetch(ptr))!=EOF) printf("%c",i); }

1 Answers  


void main() { int *mptr, *cptr; mptr = (int*)malloc(sizeof(int)); printf(“%d”,*mptr); int *cptr = (int*)calloc(sizeof(int),1); printf(“%d”,*cptr); }

1 Answers  


Categories