1 Answers

Anonymous User
Anonymous User

Fibonacci series program-

class fibo


{

public static void main(String args[])

{

 int n1=0,n2=1,n3,i,count=50;

 System.out.print(n1+' '+n2);



 for(i=2;i<count;++i)

 {

  n3=n1+n2;

  System.out.print(' '+n3);

  n1=n2;

  n2=n3;

}

}

}

Output-

0 1 1 2 3 5 8 13 21 34 55……………………………………
Addition of two matrices

class Additionmatrix

{

    public static void main(String[] args) {

   int a[][] = {{1,2,3},{5,6,9},{2,8,6}};a

   int b[][] = {{22,32,35}, {66,45,95}, {0,1,2}};

   int c[][] = new int[3][3];

   for(int i=0;i<3;i++)

  {

   for(int j=0;j<3;j++)

   {

       c[i][j]= a[i][j]+b[i][j];

       System.out.println(c[i][j]);

   }

   System.out.println(' ');

   }

  }

}

output-
23

34

38



71

51

104



2

9

8


Answer