# We have to develop 2 versions of Pseudocode for Arithmetic operations

Page 1 of 1

## 8 Replies - 503 Views - Last Post: 27 October 2013 - 12:44 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=332494&amp;s=1df6560be6c1aa2941c6e9d26c2c92cb&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

• New D.I.C Head

Reputation: 0
• Posts: 4
• Joined: 26-October 13

# We have to develop 2 versions of Pseudocode for Arithmetic operations

Posted 26 October 2013 - 12:46 PM

Problem :

Input should be :

- First digit
- operator (E.g. +, -, *, /)
- Second digit

Output should be :

- Result

Input after Result

- Ask user whether he wants to continue or not ?

Note :

- Solution must contain all 3 types of algorithmic operations
- Solution must contain sub-algorithm for each operation
- Pseudocode should terminate when 'n' is entered

Is This A Good Question/Topic? 0

## Replies To: We have to develop 2 versions of Pseudocode for Arithmetic operations

### #2 modi123_1

• Suitor #2

Reputation: 10232
• Posts: 39,365
• Joined: 12-June 08

## Re: We have to develop 2 versions of Pseudocode for Arithmetic operations

Posted 26 October 2013 - 12:56 PM

.. okay - what have you tried?

• New D.I.C Head

Reputation: 0
• Posts: 4
• Joined: 26-October 13

## Re: We have to develop 2 versions of Pseudocode for Arithmetic operations

Posted 26 October 2013 - 02:00 PM

modi123_1, on 26 October 2013 - 12:56 PM, said:

.. okay - what have you tried?

Print "Enter First Number"
Print "Enter an operator"
Print "Enter Second Number"

if operator= "+"
result=FirstNumber+SecondNumber

else operator= "-"
result=firstNumber-SecondNumber

else operator= "*"
result= FirstNumber*SecondNumber

else operator= "/"
result= Firstnumber/secondnumber

Output "your results are "FirstNumber" "Operator" "SecondNumber" = "result"

This is what i wrote, now i need a loop to terminate it on input "n" otherwise keep the program running on entering any integer..also i need to write two versions One version should use Pre-test loop and second version should use Post-test loop. Can you help?

### #4 modi123_1

• Suitor #2

Reputation: 10232
• Posts: 39,365
• Joined: 12-June 08

## Re: We have to develop 2 versions of Pseudocode for Arithmetic operations

Posted 26 October 2013 - 02:02 PM

A while loop that is condition on a character variable that is filled by user input from the console window..

• New D.I.C Head

Reputation: 0
• Posts: 4
• Joined: 26-October 13

## Re: We have to develop 2 versions of Pseudocode for Arithmetic operations

Posted 26 October 2013 - 02:04 PM

its a simple Pseudo code in english language, dont have to implement in a program. Can ypu please tell me which loop & where to add it to terminate?

### #6 modi123_1

• Suitor #2

Reputation: 10232
• Posts: 39,365
• Joined: 12-June 08

## Re: We have to develop 2 versions of Pseudocode for Arithmetic operations

Posted 26 October 2013 - 09:00 PM

I did.. I explained it in plain english..

• New D.I.C Head

Reputation: 0
• Posts: 4
• Joined: 26-October 13

## Re: We have to develop 2 versions of Pseudocode for Arithmetic operations

Posted 26 October 2013 - 11:03 PM

I asked fot putting alterative operation to repeat the loop, dont know where to put in program.. That is my question.. If it is put in the end, then what will be the condition?

### #8 GunnerInc

• "Hurry up and wait"

Reputation: 900
• Posts: 2,339
• Joined: 28-March 11

## Re: We have to develop 2 versions of Pseudocode for Arithmetic operations

Posted 26 October 2013 - 11:27 PM

Input after Result

- Ask user whether he wants to continue or not ?

Note :

- Solution must contain all 3 types of algorithmic operations
- Solution must contain sub-algorithm for each operation
- Pseudocode should terminate when 'n' is entered

You are not writing code, just saying in English how it should be done.

How would you ask the user if they want to continue or not? How would you check if user entered "n"

### #9 astonecipher

• Dishonored

Reputation: 1038
• Posts: 4,482
• Joined: 03-December 12

## Re: We have to develop 2 versions of Pseudocode for Arithmetic operations

Posted 27 October 2013 - 12:44 AM

Does the book you are using show examples of pseudo code loops? Specifically what you are looking for is using a sentinel in a loop.