So the assignment is to :
Design a program that generates 100 random numbers, and keep a count of how many of those random numbers are even and how many are odd. The function must return a Boolean value.
I wrote a code but I do not know if it is right (most likely it is not...) So i was hoping someone can help me and correct me.. OH and as I am taking a beginners class, the code is actually in pseudocode.
Declare Integer number Declare integer evens = 0 Declare integer odds = 0 Set number = random(1, 100) Display number If isEven(number) Then Display “The number “, number, “is even.” Else Display “The number “, number, “is odd.” End If Function Boolean isEven (Integer number) Declare Boolean status If number MOD 2 == 0 Then Set status = True Set evens = number + 1 Else Set status = False Set odds = number + 1 End If Return status End Function
Edited by whatthebobo