63 800
Assignments Done
99,5%
Successfully Done
In August 2018

Answer to Question #3478 in Java | JSP | JSF for Y mukundareddy

Question #3478
(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.
Expert's answer
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]);
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions