1.Write a code fragment that prints the contents of a two-dimensional boolean array, using * to represent true and a space to represent false. Include row and
column numbers.package homework;
2.What values does the following code put in the array a [] ?
int N = 10;
int[] a = new int[N];
a[0] = 1;
a[l] = 1;
for (int i = 2; i < N; i++)
a[i] = a[i-l] + a[i-2];
3.Write a static method max3 () that takes three int values as arguments and returns the value of the largest one.Add an overloaded function that does the same thing with three double values.
1
Expert's answer
2015-07-10T02:27:44-0400
2. It is Fibonacci number. The first two numbers in the Fibonacci sequence are either 1 and 1 and each subsequent number is the sum of the previous two. package array;
import java.util.Random;
public class Demo { final static Random random = new Random();
Comments
Leave a comment