the first one is this:
/ Determine how much is the sum of the elements of the fibonacci series between 0 and 100 /
#include<iostream>
using namespace std;
int main()
{
int i,numero,x,y,z;
numero = 11;
x = 1;
y = 1;
z = 0;
for(i=0;i<=numero;i++)
{
z = x + y;
x = y;
y = z;
}
cout << "La suma es: " << z;
}
this gives me a wrong value if I set it to i = 0 to 377, if I start i = 1, it gives me 233 and the final value should give 232.
the others are these 2 that I have no idea how to make them are these:
/ Determine how much the whole average of the elements of the fibonaci series equals between 0 and 1000. /
#include<iostream>
using namespace std;
int main()
{
int x,y,z,numero,acumulado,i,promedio;
x = 0;
y = 1;
z = 0
numero = 16;
acumulado = 0;
promedio = 0;
for(i=2;i<=numero;i++)
{
z = x + y;
x = y;
y = z;
acumulado = acumulado + z;
}
cout << acumulado << endl;
promedio = acumulado/numero;
cout << "El promedio es: " << promedio;
return 0;
}
/ Determine how many elements of the fibonnaci series are between 1000 and 2000 /
#include<iostream>
using namespace std;
int main()
{
int contador,x,y,z;
x = 0;
y = 1;
z = 0;
while(z<=2000)
{
if(z>=1000)
{
contador++;
}
z = x + y;
x = y;
y = z;
}
cout << "Hay " << contador << " elementos entre 1000 y 2000 de la serie fibonacci";
return 0;
}
if you can explain them without the answer to be able to make them a guide or something (I'm just starting in this, I've been practicing since November of last year practicing, reading and looking for exercises, now I'm with the cycles, within 1 month I enter the university and I'm practicing).