Input = Fourdigitnum
Output = digit1, digit2, digit3, digit4


Major Task (Module/Subproblems)

1. Receive Fourdigitnum
2. Extract the Fourdigitnum received
3. Remove the digit from the original number
4. Display digit
5. Repeat Step 2


1. Fourdigitnum ("Enter a four-digit positive integer: ")
Receive Fourdigitnum

2. digit1= (Fourdigitnum)/1000


3. (Fourdigitnum)%1000

Fourdigitnum=Fourdigitnum/100

digit2=Fourdigitnum

Fourdigitnum=Fourdigitnum/10

digit3= Fourdigitnum

Fourdigitnum=Fourdigitnum%10

digit4= Fourdigitnum


4. Display digit1, digit2, digit3, digit4

5. End Repeat

Recommended Answers

All 2 Replies

where's the code? also this algo will always work only for 4 digit numbers, with a little more effort you can convert it to a general code for any no. of digits in the number..

what code? this the IPO Chart

Here are my instruments

For IPO,
the I(nput) should be the name(s) you like to use to capture the input(s) of the problem. The O(utput) should be the name(s) you like to use to store the expected output(s) produced by your solution. Be sure all your identifiers/names are valid ones. Please refer to your class notes and text book for details about valid identifiers.
The P(rocess) section should have only description of what major tasks need to be completed in solving the problem. NO DETAILS about how to complete each task are needed. For instance, DO NOT say "subtract DEDUCTION from GROSS_PAY and save result in NET_PAY" in P(rocess) section. Say something like "Compute net pay." instead.
Leave the details about "How" to "Compute net pay." in your Solution Algorithm. So you can concentrate on one task at a time.
Absolutely NO C++ code or keyword of any kind should be used (they are not even needed) in Part I of the Assignment

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.