Pell series is the twice of the second number and add the first number.
For example: if a=1 , b=2
A+b*2 the result will be 5.
Code:
class my{
public static void main(String args[]){
int a=1,b=0,s;
for(int i=1;i<=10;i++){
s=a+(b*2);
a=b;
b=s;
System.out.println(s);
}
}
}
Output
1
2
5
12
29
70
.
.
.
.
For example: if a=1 , b=2
A+b*2 the result will be 5.
Code:
class my{
public static void main(String args[]){
int a=1,b=0,s;
for(int i=1;i<=10;i++){
s=a+(b*2);
a=b;
b=s;
System.out.println(s);
}
}
}
Output
1
2
5
12
29
70
.
.
.
.
Comments
Post a Comment