8 Replies - 346 Views - Last Post: 27 October 2013 - 12:44 AM Rate Topic: -----

#1 Fahad4014  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • 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  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8891
  • View blog
  • Posts: 33,339
  • 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?
Was This Post Helpful? 0
  • +
  • -

#3 Fahad4014  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • 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

View Postmodi123_1, on 26 October 2013 - 12:56 PM, said:

.. okay - what have you tried?


Print "Enter First Number"
FirstNumber=Read_Input
Print "Enter an operator"
Operator=Read_input
Print "Enter Second Number"
SecondNumber=Read_input

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?
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8891
  • View blog
  • Posts: 33,339
  • 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..
Was This Post Helpful? 0
  • +
  • -

#5 Fahad4014  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • 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?
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8891
  • View blog
  • Posts: 33,339
  • 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..
Was This Post Helpful? 0
  • +
  • -

#7 Fahad4014  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • 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?
Was This Post Helpful? 0
  • +
  • -

#8 GunnerInc  Icon User is offline

  • "Hurry up and wait"
  • member icon




Reputation: 858
  • View blog
  • Posts: 2,276
  • 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"
Was This Post Helpful? 0
  • +
  • -

#9 astonecipher  Icon User is offline

  • Major DIC Head
  • member icon

Reputation: 547
  • View blog
  • Posts: 2,439
  • 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.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1