sum of fibonacci series in java without scanner
Answers
Answered by
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);
}
}
{
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
English,
8 months ago
Business Studies,
8 months ago
Math,
8 months ago
Science,
1 year ago
Math,
1 year ago
Accountancy,
1 year ago