CS2263/Assigments/1/Shoebottom_Isaac_A1/isFib.c

9 lines
188 B
C
Raw Permalink Normal View History

2023-05-22 23:28:51 -03:00
#include <math.h>
int isPerfectSquare(int i) {
int s = sqrt(i);
return (s*s == i);
}
int isFib(int i) {
return isPerfectSquare(5*i*i+4) || isPerfectSquare(5*i*i -4);
}