I need to write a program that will list the fibonacci sequence up until a million (This part is done) and then out of the numbers, I need to take the square roots, and only print the ones that return whole numbers, if I take the square roots of each number (being int's, It will return all the answers rounded to the nearest whole number, which is not what I need. Since I don't even know where to begin on this, I have no code implementing the square root portion. Not asking for it to be done for me , just where do I start maybe? Thanks
Language - C
#include <stdio.h>
#include <math.h>
int main(void)
{
int x, y, z,c,s;
double d;
x=1; /*Initiating the first values of the fibonacci sequence*/
y=1;
z=0;
c=1; /*Initiating the first value for the count*/
printf("%d\n", x); /*The first two values of the sequence are printed here*/
printf("%d\n", y);
while (z<1000000)
{
z=x+y;
x=y;
y=z;
c++;
if (z<1000000)
printf("%d\n", z);
}
printf("The amount of numbers in the follwing sequence is %d\n", c);
return (0);
}
Language - C
#include <stdio.h>
#include <math.h>
int main(void)
{
int x, y, z,c,s;
double d;
x=1; /*Initiating the first values of the fibonacci sequence*/
y=1;
z=0;
c=1; /*Initiating the first value for the count*/
printf("%d\n", x); /*The first two values of the sequence are printed here*/
printf("%d\n", y);
while (z<1000000)
{
z=x+y;
x=y;
y=z;
c++;
if (z<1000000)
printf("%d\n", z);
}
printf("The amount of numbers in the follwing sequence is %d\n", c);
return (0);
}