Answer:lol :)
Explanation:
Yes, the special order is 6 5 and 7 and it is/
Answer:
value=int(input("Enter the number up-to the user wants the Fibonacci series: "))
a=0
b=1
c=1
for x in range(value):
print(c,end=" ")
c=a+b
a=b
b=c
Output :
- If the user input 5, then the output is "1 1 2 3 5".
- If the user input 10, then the output is "1 1 2 3 5 8 13 21 34 55".
Explanation:
- The above defined a python program which is used for the Fibonacci series.
- The first line of the program is used to instruct the user and take the input from the user.
- Then the for loop executes up-to that range value.
- Then in the for-loop, the two variable needs to store the current value and previous value which is used to give the series after addition.
Please Help! Unit 6: Lesson 1 - Coding Activity 2
Instructions: Hemachandra numbers (more commonly known as Fibonacci numbers) are found by starting with two numbers then finding the next number by adding the previous two numbers together. The most common starting numbers are 0 and 1 giving the numbers 0, 1, 1, 2, 3, 5...
The main method from this class contains code which is intended to fill an array of length 10 with these Hemachandra numbers, then print the value of the number in the array at the index entered by the user. For example if the user inputs 3 then the program should output 2, while if the user inputs 6 then the program should output 8. Debug this code so it works as intended.
The Code Given:
import java.util.Scanner;
public class U6_L1_Activity_Two{
public static void main(String[] args){
int[h] = new int[10];
0 = h[0];
1 = h[1];
h[2] = h[0] + h[1];
h[3] = h[1] + h[2];
h[4] = h[2] + h[3];
h[5] = h[3] + h[4];
h[6] = h[4] + h[5];
h[7] = h[5] + h[6];
h[8] = h[6] + h[7]
h[9] = h[7] + h[8];
h[10] = h[8] + h[9];
Scanner scan = new Scanner(System.in);
int i = scan.nextInt();
if (i >= 0 && i < 10)
System.out.println(h(i));
}
}
Answer:
2.82
Explanation:
The computation of the average number of cycles per instruction is shown below:
= Arithmetic/logical operations × frequency cycles + Register load operations × frequency cycles + Register store operations × frequency cycles + Unconditional branch instructions × frequency cycles + Conditional branch instructions × frequency cycles
= 45% × 1 + 18% × 5 + 10% × 2 + 7% × 1 + 20% × 6
= 0.45 + 0.9 + 0.2+ 0.07 + 1.2
= 2.82