Question:
Barcelona has an instruction count of 2.389E12, an execution time of 750 s, and a reference time of 9650 s.
Answer:
New CPI is 1.379
Explanation:
Given:
Clock Rate=4 GHz
Reduction in number of instructions=15%
Execution time=700 sec
Instruction Count=
Find:
New CPI=?
Solution:
Cycle Time=1/Clock Rate

Execution Time= Clock cycles * Cycle Time
Clock Cycles=Execution Time/Cycle Time


New Instruction Count=
*0.85
New Instruction Count=

New CPI is 1.379
You're substracting one from the variable "exponent" with every iteration of the loop, and you told it to break out of the loop once "exponent" is 0, therefore, it's always going to end up as 0 at the end.
If you want to keep the input from the user, then declare another variable like "counter" and assign the value of "exponent" to it and use it for the loop
Or even better, do this for the loop:
for(int i = 0; i < exponent; i++)
{
//Code here
}
Its either D or A but im pretty sure its D??
Make you depressed? (wild guess) (new to this)