Computer Science, asked by RISHI1502, 1 year ago

Print the series by using FOR LOOP in Q BASIC
S=1,1,2,3,5,8,13,.... up to N no. of terms

Answers

Answered by akashnilroy
1
int i,s=0,a=1,b=1,n;
System.out.println("Enter n");
System.out.println(a + "," + b);
n= Interger.parseInt(br.readLine());
for(i=0;i<=n;i++)
{
s = a +b;
a=b;
b=s;
System.out.println("," + s);
}
Similar questions