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
How can learning opportunities for AI be extended to all
statuscvo [17]

Answer:

Learning opportunities for AI can be extended to all through the inclussion of courses and different teaching methods related to Artificial Intelligence, new technologies, computer science, programming and, in short, everything related to the digital world, in the educational plans at the national level. This is so because artificial intelligence and computer systems are the basis for the development of the new tools jobs of tomorrow. Thus, education in these subjects is essential so that citizens can enter the labor market once they acquire the necessary age, having the knowledge to do so in a proper way.

6 0
2 years ago
NEED HELP NOW 25 POINTS WILL MARK BRAINLIEST!!!
erastova [34]
The answers are:
C
A
Hope it helps :)
6 0
2 years ago
Read 2 more answers
You want to use a terminal emulation program to terminal into a series of Cisco routers. You will be managing these devices remo
vampirchik [111]
If a terminal emulation program is used and the devices should be reotely managed, then you should use the Telnet protocol. <span>Telnet is a simple, text-based network protocol that is used for accessing remote computers over TCP/IP networks like the Internet. </span>It allows the user access<span> to a text terminal and all its </span>applications<span> such as command-line for example. </span>

7 0
2 years ago
Low-level formatting ____. Group of answer choices is different from physical formatting is usually performed by the purchaser o
Drupady [299]

Low-Level formatting is usually performed by the purchaser of the disk.

<h3>What is low-level formatting?</h3>

Low-Level formatting can be defined as is performed at the factory which electronically creates the hard drive tracks and sectors and tests for bad spots on a disk surface.

Low-level formatting is usually performed by the purchaser of the disk device.

Therefore, B is the correct option.

Learn more about Low-level formatting here:

brainly.com/question/13797778

#SPJ1

3 0
2 years ago
4.which pre-defined feature is known as functions in Excel?<br> a.formula<br> b.property<br> c. data
lesya692 [45]

Answer:

I think formula?

Explanation:

8 0
2 years ago
Other questions:
  • What is the name of the feature that can be enabled on slower-speed WAN links to prevent a large data transfer from affecting th
    10·1 answer
  • Three variables, x, y and z, supposedly hold strings of digits, suitable for converting to integers. Write code that converts th
    7·1 answer
  • Is there truth? Does truth exists?
    14·2 answers
  • What is the purpose of the operating system's processor management function?
    14·1 answer
  • What's the inputs and outputs in a kitchen?
    14·1 answer
  • Mention two strategies of collecting data​
    13·1 answer
  • Given a constant named size with a value of 5, which statement can you use to define and initialize an array of doubles named ga
    12·1 answer
  • Suppose we want to select between two prediction models M1 and M2. We have performed 10-fold cross validation on each. The error
    14·1 answer
  • ! (( i &gt; ( f + 1)) es verdadero o falso segun la logica de programación.
    14·1 answer
  • A(n) ______is like an intranet except it shares its resources with users from a distant location. Select your answer, then click
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!