(1) Write a program to create an array with size of 10 elements and give the ten values to the array and print those values on the console.
1
Expert's answer
2011-08-07T07:17:49-0400
public class Task8 { public static void main(String[] args) { & // The array that contains the first 10 fibonacci numbers & int[] fibonArray = new int[10]; & fibonArray[0] = fibonArray[1] = 1; & for (int i = 2; i < 10; i++) & fibonArray[i] = fibonArray[i - 1] + fibonArray[i - 2];
& // Printing the array to the console & System.out.print("The array values:\n" + fibonArray[0]); & for (int i = 1; i < 10; i++) & System.out.print(", " + fibonArray[i]); } }
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment