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
sergejj [24]
2 years ago
6

Write a program that inputs a five-digit integer, spearates the integer into its digits and prints them seperated by three space

s each. [Hint: Use the ineger division and remainder operators.]
Computers and Technology
1 answer:
FromTheMoon [43]2 years ago
8 0
<h2>Explanation:</h2>

The source code and a sample output have been attached to this response.

The code has been written in Java and it contains comments explaining important parts of the code.

A few things that are worth noting are in the for loop used in the code;

<em><u>The loop goes from i = 4 to i = 0</u></em>

<em>When i = 4;</em>

=> (int) Math.pow(10, i) = (int) Math.pow(10, 4) = 10000

Then the <em>fiveDigit</em> is divided by 10000. Since this is an integer division, the first digit of the 5-digit number will be stored in <em>digit </em>which is then printed to the console.

Next, the remainder is calculated and stored in <em>fiveDigit</em>

<em>When i = 3;</em>

=> (int) Math.pow(10, i) = (int) Math.pow(10, 3) = 1000

Then the <em>fiveDigit</em> (which is the remainder when i = 4) is divided by 1000. Since this is an integer division, the second digit of the 5-digit number will be stored in <em>digit </em>which is then printed to the console.

Next, the remainder is calculated and stored in <em>fiveDigit</em>

<em>When i = 2;</em>

(int) Math.pow(10, i) = (int) Math.pow(10, 2) = 100

Then the <em>fiveDigit</em> (which is the remainder when i = 3) is divided by 100. Since this is an integer division, the third digit of the 5-digit number will be stored in <em>digit </em>which is then printed to the console.

Next, the remainder is calculated and stored in <em>fiveDigit</em>

<em>When i = 1;</em>

(int) Math.pow(10, i) = (int) Math.pow(10, 1) = 10

Then the <em>fiveDigit</em> (which is the remainder when i = 2) is divided by 100. Since this is an integer division, the fourth digit of the 5-digit number will be stored in <em>digit </em>which is then printed to the console.

Next, the remainder is calculated and stored in <em>fiveDigit</em>

<em>When i = 0;</em>

(int) Math.pow(10, i) = (int) Math.pow(10, 0) = 1

Then the <em>fiveDigit</em> (which is the remainder when i = 1) is divided by 1000. Since this is an integer division, the fifth digit of the 5-digit number will be stored in <em>digit </em>which is then printed to the console.

Next, the remainder is calculated and stored in <em>fiveDigit </em>and then the program ends.

You might be interested in
How to resize an image in photoshop without losing quality.
castortr0y [4]

Answer:

Explanation:

Make sure resample is turned on

Turn on the chain link if you want the width and height to change together. If not, turn off the chain so that you can set your own width and height.

Choose your new size (you can choose to choose different measurement units by clicking on “inches”)

press ok

i hoped this helped!!!!!!!!

8 0
2 years ago
What is a killer app??
mars1129 [50]
Application of a new technology and is much superior to rival products
6 0
3 years ago
What email server does Global Enterprises use?
harina [27]

Answer:

Global Enterprises uses an open source mail server called Courier.

Explanation:

6 0
3 years ago
A user has multiple web pages open and is using email. Which layer of the Transmission Control Protocol/Internet Protocol (TCP/I
Fudgin [204]

Answer:

This is the second question like this I've seen. They aren't the greatest.

Explanation:

The question is not good. The answer would be option a, Transport even though it doesn't make a whole lot of sense when you really go into detail.

It could also be option d, Application but I think they're going for the first.

6 0
2 years ago
Please, give me a comic or story idea. I will mark brainliest. ( i need 5 slides with 2 characters in the story or comic) Please
salantis [7]

Answer:

Jack and John

Explanation:

Jack called John and offered him to come with him and some other friends to go out to the mall.

.....

8 0
3 years ago
Read 2 more answers
Other questions:
  • Radiation requires a heated liquid to transfer energy. Please select the best answer from the choices provided T F
    10·2 answers
  • You are provisioning a server with eight-core 3 GHz CMP that can execute a workload with an overall CPI of 2.0 (assuming that L2
    5·1 answer
  • In 1971, Intel created and marketed the first microprocessor chip, called the Intel 4004. What was significant about this invent
    7·1 answer
  • While you are working on your computer, it shuts down unexpectedly, and you detect a burning smell. When you remove the case cov
    9·1 answer
  • If I wanted to repeat an action such as a heading for a paper, it would be helpful to _____. create a citation create a caption
    9·2 answers
  • How do I insert a row above the selected row in between row and row 2 revenue xls
    5·1 answer
  • Item 8 Item 8 Shelby Black runs a very successful hair salon in downtown Los Angeles. One of Shelby’s tasks is to input positive
    13·1 answer
  • You are now going to prepare some reports for the company. Measurements are in metres and volume
    7·1 answer
  • There are parallels between the trust models in Kerberos and Public Key Infrastructure (PKI). When we compare them side by side,
    15·1 answer
  • Kinda strange, and im good
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!