1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
bonufazy [111]
3 years ago
14

I need help to find out what is wrong with this program and my variable, "exponent" comes out as 0 in the output instead of the

number i typed, "3".

Computers and Technology
1 answer:
sweet-ann [11.9K]3 years ago
3 0

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

}

You might be interested in
Olivia is an amputee who wears a prosthetic right hand. Which technology would most help her operate a computer?
satela [25.4K]
Nerve interface is technology that allows amputees to use thoughts to move prosthetics
3 0
2 years ago
__________ refers to the coupling of data stored in files and the specific programs required to update and maintain those files
atroni [7]
I think it is good for the environment
7 0
4 years ago
The instruction format of a computer is given by one indirect bit, opcode bits, register address bits, immediate operand bits an
oksian1 [2.3K]

Answer:

Following are the answer to this question:

Explanation:

A)

The memory size is 1 Giga Bytes which is equal to 2^{30}

\texttt{Number of address bits    \ \ \ \ \ \ \ \ \ \ \ \ \ \            Number of addresses}\\\\ \ \ \ \ 30  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \                                 2^{30}= 1073741824

B) \texttt{I \ \ \ Opcode  \ \ \ Register address \ \ \  Immediate operand \ \ \    Memory address}\\\\\\\textt{1 \ bit  \  \ \ \ \ \ 128  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \    2 \ bits   \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \   24 \ bits  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \  \ \ \ \ \ \ \ \ \           30 \ bits}\\\\\\            = 2^7 \\\\ = 7 \ bits

calculating the register Bits:

= 64-(1+7+24+30)\\\\=64 -62\ \  bits\\\\= 2\ \ bits\\

C)

Immediate value size while merging the additional benefit with the address field:

= 2^{24} + 2^{30}\\\\= 2^{54}\\\\\texttt{Range before combining(-,+) 24 bits   \ \ \ \ \ \       Range after combining( -,+)54bits}\\\\                         \textt{-2^{12} from + (2^{12}-1)   \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \                                    -2^{27} from + (2^{27}- 1)}

= \frac{24}{2} = 12\\\\= \frac{54}{2} = 27

The range is accomplished by dividing the bits by 2 into the two sides of the o and the number is one short to 0.

8 0
3 years ago
Choose all items that represent features of the job application process
oksano4ka [1.4K]

Where are the Options

6 0
3 years ago
A high-angle shot is the same thing as a bird’s-eye shot. True False
mariarad [96]
I believe that is false, but note I could be wrong.
7 0
3 years ago
Read 2 more answers
Other questions:
  • Two users, UserA and UserB, are engaging in secure communication using only asymmetrical encryption. UserA needs to send a secur
    11·1 answer
  • Which osi model layer manages data encryption?
    14·1 answer
  • Two types of business communications enhanced by desktop publishing are
    7·2 answers
  • Stella is a bank executive. She is preparing a spreadsheet on the loan repayment schedules of customers. Which function can she
    9·1 answer
  • Why would a person who handles electronic components wear a grounded wrist strap
    13·1 answer
  • Some hardware can be added to the computer without having to restart or power down the computer. After a short period of time th
    5·1 answer
  • You've been hired by Maple Marvels to write a C++ console application that displays information about the number of leaves that
    5·1 answer
  • Hey guys im just curious.... whats ur favorite number
    6·2 answers
  • ***URGENT***
    8·1 answer
  • All of the salespeople in hyperactive media sales use laptops, so that they can take their applications and data on the road to
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!