Computer Science, asked by StutiDey, 1 year ago

sum of fibonacci series in java without scanner

Answers

Answered by rashi61
3
class sum1
{
void main (int n)
{
int I, a, b, s;
a=0;b=1;s=0;
for(i=3;i<=n; i++)
{
int c=a+b;
s=s+c;
a=b;
b=c;
}
system. out. println("sum is="+s);
}
}


rashi61: I hope this answer will help you out.
Similar questions