Hey i am wondering
What is the purpose of this code. i have trouble reading Psuedo:'( .
Begin
myNumber = 0
mycounter = 0
Input myinput
While myNumber is less than myInput
IF myNumber is even
Increment myTally
End IF
Increment mycounter
End While
Print mycounter
Print Mynumber
End
Pseudocode HelpNewb Question
Page 1 of 1
5 Replies - 2014 Views - Last Post: 17 March 2005 - 07:36 AM
Replies To: Pseudocode Help
#2
Re: Pseudocode Help
Posted 16 March 2005 - 09:41 PM
Nismo662, on Mar 16 2005, 09:28 PM, said:
Begin //this is pseudo for the entry point, (c++ - void main())
myNumber = 0 //these are variables, probably integers
mycounter = 0
Input myinput //prompt the user for input, probably another integer
While myNumber is less than myInput //while the above integer is less than the input number
IF myNumber is even //self explanatory
Increment myTally //add one to the myTally integer
End IF
Increment mycounter //increment a counter of some sort
End While
Print mycounter //display the counter
Print Mynumber //print 'mynumber' variable
End //end program
myNumber = 0 //these are variables, probably integers
mycounter = 0
Input myinput //prompt the user for input, probably another integer
While myNumber is less than myInput //while the above integer is less than the input number
IF myNumber is even //self explanatory
Increment myTally //add one to the myTally integer
End IF
Increment mycounter //increment a counter of some sort
End While
Print mycounter //display the counter
Print Mynumber //print 'mynumber' variable
End //end program
My comments are in the quote.
#3
Re: Pseudocode Help
Posted 16 March 2005 - 09:41 PM
Also, welcome to dream.in.code!
#4
Re: Pseudocode Help
Posted 16 March 2005 - 09:46 PM
Whoa you guys are fast. Thnx for the welcome. Hopefully soon i can contribute too
#5
Re: Pseudocode Help
Posted 16 March 2005 - 09:49 PM
User types in a number.. then it loops for that number of times and counts all the even numbers ?
This post has been edited by Nismo662: 16 March 2005 - 10:42 PM
#6
Re: Pseudocode Help
Posted 17 March 2005 - 07:36 AM
It loops while the number entered by the user is greater than the compared number, and counts each even entry. myTally is the variable that holds the number of even entries. myCounter holds the total number of entries.
In this case, as long as the user enters positive numbers (greater than 0), the program will loop.
In this case, as long as the user enters positive numbers (greater than 0), the program will loop.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|