Hello, I am new to this web and new to programming. I am not sure what does mean the following algorithm:
set counta = 0
set countb = 0
read number
while read was succesful do
if number mod 2 equals 0
then
set counta = counta + 1
otherwise
if number mod 4 equals 0
then
set countb = countb + 1
read number
write counta
write countb
.......................................................
I need help with this:
Explain: 1- what takes as input
2- clearly specify any assumption regarding the input
3- what Generates as output (not what output means)
4- what does (relationship btw input and output)
What I have done is
1 this takes as input any number right?
2 I think that the number should be any number >= 0 ?
3 for counta and countb will be always 1?
4 there is relationship because for counta and countb to be 1, the number need to be 0??
also what does counta = 0 means? It means that counta is zero always?
thank you very much for your help!!
ragonss 0 Newbie Poster
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.