Â
In this, we are going to write a simple program to print the first 15 numbers of the Pell
series in Java.
class Pell
{
public static void main(String[] args)
{
long i, f = 1, s = 0, t;
System.out.println("The Pell Series is: \n");
for (i = 1; i <= 50; i++)
{
t = f + 2 * s;
System.out.print(t + "\n");
f = s;
s = t;
}
}
}
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP