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
docker41 [41]
3 years ago
8

Write an algorithm that receives a number from the user (you can store the number in a variable called N). Then the algorithm sh

ould separate the digits of the number and print each in a line starting from the number at one’s place, then the number at ten’s place, and so on. Example: if user inputs 329, then the algorithm should produce the following three lines.
9

2

3
Computers and Technology
1 answer:
lbvjy [14]3 years ago
7 0

Answer:

Algorithm:

1. Declare an integer variable N.

2. Read the value N from user.

3.While(N):

 3.1 find r=N%10;

 3.2 print r in new line.

 3.3 Update N as N=N/10.

4.end program.

Implementation in C++.

// header

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

// variable

int N;

cout<<"Enter an Integer:";

   cin>>N;

// find the digits of number

   while(N)

   {

       // last digit

       int r=N%10;

       // print last digit

       cout<<r<<endl;

       // update the number

       N=N/10;

}

return 0;

}

Output:

Enter an Integer:329                                        

9                                                          

2                                                          

3

You might be interested in
Why should teachers refrain from using extreme language, such as “I’m dying of hunger,” around four- and five-year-old children?
swat32

Answer:

Teachers of four and five year old children should refrain from using sentences such as "i'm dying of hunger," because children so young could take the death part of the comment to literally, they are small children, and do not yet fully understand the concept of figure of speech or over exaggeration.

3 0
3 years ago
The ____ command is used to disconnect a datatable object from the database. (
lisabon 2012 [21]
The delete from command I think
7 0
3 years ago
Read 2 more answers
Write a short note on Magnetic tape as a secondary storage device​
Tanzania [10]

Answer:

In magnetic tape only one side of the ribbon is used for storing data. It is sequential memory which contains thin plastic ribbon to store data and coated by magnetic oxide. Data read/write speed is slower because of sequential access. It is highly reliable which requires magnetic tape drive writing and reading data.

Explanation:

6 0
3 years ago
Let A and B be two stations attempting to transmit on an Ethernet. Each has a steady queue of frames ready to send; A’s frames w
Mariana [72]

Answer:

Following are the solution to the given question:

Explanation:

Please find the complete and correct question in the attachment file.  

For Point a:

For the second round,

A is selects kA(2)  either 0 or 1, so for each of them, that is \frac{1}{2}.

B selects kB(2)\  from\  (0, 1, 2, 3) for each choice with the probability of \frac{1}{4}.

If kA(2) < kB(2) wins the second rear race.

\to P[A \ wins] = P[kA(2) < kB(2)]

                     = P[kA(2) = 0] \times P[kB(2) > 0] + P[kA(2) = 1] \times P[kB(2) > 1]\\\\= \frac{1}{2} \times \frac{3}{4}  + \frac{1}{2}  \times \frac{2}{4} \\\\=\frac{3}{8}  +\frac{2}{8} \\\\= \frac{3+2}{8}\\\\= \frac{5}{8}

For Point b:

Throughout this example, kA(3) also selects to be either 0 or 1 with such a \frac{1}{2} probability. So, although B chooses kB(3) from (0, 1, 2, 3, 4, 5, 6, 7), the probabilities each are \frac{1}{8}:

\to P[A \  wins] = P[kA(3) < kB(3)]

                     = P[kA(3) = 0] \times P[kB(3) > 0] + P[kA(3) = 1] \times P[kB(3) > 1]\\\\= \frac{1}{2} \times \frac{7}{8} + \frac{1}{2} \times \frac{6}{8}\\\\= \frac{7}{16} + \frac{6}{16}\\\\= \frac{7+6}{16} \\\\= \frac{13}{16}\\\\

For point c:

Assume that B tries again 16 times (typical value), and it destroys. In addition, throughout the exponential background n is obtained at 10 when choosing k between 0 to 2n−1. The probability of A winning all 13 backoff events is: P[A \text{wins remaining races}] = 16\pi i =4P[A \ wins \ i |A \ wins \ i -1 ]

Let the k value kA(i) be A for the backoff race I select. Because A retains the breed

=(kA(i)] \cdot P[kA(i+ 1)< kB(i+ 1)] \geq P[kA(i) + 1

For point d:

Two stations A and B are supposed. They assume that B will try 16 times afterward. Even so, for A, 16 races were likely to also be won at a rate of 0.82 For Just higher expectations of three A, B, and C stations. For Station A, possibility to win all backoffs

3 0
3 years ago
The specific gravity of gold is 19.3. Write a MATLAB program that will ask the user to input the mass of a cube of solid gold in
s344n2d4d5 [400]

Answer:

Check the explanation

Explanation:

<em>Cube.m:</em>

mass = input("Enter the mass of cube [kilograms]: ");

if(mass<=0)

disp("Error: Mass must be greater than zero grams")

else

fprintf("The length of one side of cube is %.2f inches",2.7*mass);

end

<em>Output1</em>

octave:2> source ( Cube.m Enter the mass of cube [kilograms]: octave:2>-3 Error: Mass must be greater than zero grams

<em />

7 0
4 years ago
Other questions:
  • Which activity constitutes legal computer activity?
    12·1 answer
  • What additional information could you add to a sketch to provide other team members with a more accurate design drawing?
    9·1 answer
  • What are three ways you cite evedince
    5·2 answers
  • Given a String variable named line1 and given a Scanner reference variable stdin that has been assigned a reference to a Scanner
    11·1 answer
  • Why would a network administrator want to filter certain ports when capturing data such as FTP traffic
    6·1 answer
  • Which of the following is NOT a media file? *<br> .wav<br> .mp4<br> .exe
    10·1 answer
  • Which shortcut keys can be used to duplicate a slide?
    15·1 answer
  • Proceso de producción del grabado
    8·1 answer
  • Which characters are used in hump notion?
    12·1 answer
  • A small _____ at the lower right corner of a tool indicates that it contains hidden tools​
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!