series programs in java

Solutions on MaxInterview for series programs in java by the best coders in the world

showing results for - "series programs in java"
Alessia
17 Apr 2017
1import java.util.Scanner;
2public class Example25  {
3
4    public static void main(String args[])
5    {
6	int n,a=1,b=0,c;
7    System.out.println("First 20 Pell numbers: ");
8    for(n=1; n<=20; n++)
9     {
10      c= a + 2*b;
11      System.out.print(c+" ");
12      a = b;
13      b = c;
14     }
15   }
16 }
17
18