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
kupik [55]
2 years ago
6

#11. Write a program that prompts the user to input a four-digit positive integer. The program then outputs the digits of the nu

mber, one digit per line. For example, if the input is 3245, the output is:
Computers and Technology
1 answer:
JulsSmile [24]2 years ago
7 0

Answer:

<em>C++</em>

/////////////////////////////////////////////////////////////////////////////////////

#include <iostream>

using namespace std;

int main() {

   int number;

   cout<<"Enter four digit positive integer: ";

   cin>>number;

   ///////////////////////////////////////////////

   int divisor = 1000;

   int digit;

   

   if ((number > 999) && (number < 9999)) {

       for (int i=0; i<3; i++) {

           digit = number/divisor;

           number = number%divisor;

           divisor = divisor/10;

           cout<<digit<<endl;

       }

       cout<<number;

   }

   else {

       cout<<"Invalid range!";

   }

   ///////////////////////////////////////////////

   return 0;

}

Explanation:

To accomplish the task, we need to use the divide and modulo operators.

To get each digit, we need to divide the variable number by the divisor (which is initialized to 1000).

We also need to reset the number variable to one less digit from the right. We can do this by number modulo divisor, which is assigned back to the number variable.

Finally we need to lower the divisor by 10 each time in the loop, to keep it in accordance with the above two operations.

You might be interested in
State three advantages of using a printer​
Vera_Pavlovna [14]

Answer:

Advantage: Convenience. One of the key advantages of printing out material is that it is convenient.

Advantage: Secure Delivery. Paper records can be anonymously delivered

Advantage: Ease of Reading

I hope It helps

7 0
3 years ago
________ are used to translate each source code instruction into the appropriate machine language instruction.
Liono4ka [1.6K]

Answer:

compillers

Explanation:

computer programs belong in three classes; these are

Machine language (0s and 1s)

Assembly language and Highlevel languages

The popular programming languages like Java, C, C++, Python etc are all examples of high level languages. When programs are written in these highlevel languages, the programs will require another special program called compillers to carryout a translation from the highlevel language to a machine level (0s and 1s) which is the level that is executable by computers.

8 0
3 years ago
To display or distribute information from a database, programmers or database administrators create ___ .
Rainbow [258]
The answer is Reports.  To display or distribute information from a database, programmers or database administrators create Reports.
3 0
3 years ago
Let X and Y be two decision problems. Suppose we know that X reduces to Yin polynomial time. Which of the following statements a
DerKrebs [107]

Answer:

d. If X is NP - complete and Y is in NP then Y is NP - complete.

This can be inferred

Explanation:

The statement d can be inferred, rest of the statements cannot be inferred. The X is in NP complete and it reduces to Y. Y is in NP and then it is NP complete. The Y is not in NP complete as it cannot reduce to X. The statement d is inferred.

4 0
2 years ago
Write down the stages in the information prcessing cycle in correct order​
Naddika [18.5K]

Answer:

The answer is below

Explanation:

The various stages in the information processing cycle in the correct order​ is as follows:

1. Input stage: this is when the data is sent into the computer through the hardware

2. Processing stage: this when the is being refined in the central processing unit of the computer

3. Storage stage: this is when the data is being saved or stored in the computer memory such as Hard drive or external storage such as Flash drive

4. Output stage: this is when the refined or processed data is produced to the user either through the monitor screen or printing

4 0
3 years ago
Other questions:
  • Anna wants to open the Run dialog box to run her program file. Which keys should she press to open the Run dialog box?
    14·1 answer
  • What is the main storage device where the computer stores data?
    15·1 answer
  • Given the following business scenario, create a Crow's Foot ERD using a specialization hierarchy if appropriate. Granite Sales C
    12·1 answer
  • True or False?
    8·1 answer
  • 8.7 lesson practice question 1
    13·1 answer
  • They are correct? thank you!
    6·2 answers
  • Consider the following declaration:
    9·1 answer
  • I NEED THIS ASAP PLS
    12·1 answer
  • Describe comm<br>unication cycle​
    15·2 answers
  • Web résumés allow you to include extra graphics and images that you would not include in a traditional résumé. please select the
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!