0

Hi.. Im new here and im in 10 grade .. We have our T.L.E
its cumputer programing. And because im new in programing i dont really have any idea about this thing so if anyone can know how can i understand and answer my assignment i really appreciate it .
Question: create an algorithm to determine the even numbers given a lost of numbers
List 123456
Output 246

Please help me i really really need this one

THANKS

5
Contributors
4
Replies
36
Views
4 Years
Discussion Span
Last Post by kvahanyan
1

do you know the % operator? do you know how to use an loop? do you know how to use an array? those are really all you need to figure this out.

1

For such a question, I would go with a simple language like Python, because; why overcomplicate, something? Anyways here is the general [pseudocode] approach to answering this question.
PSEUDOCODE:

for each value in list:
    if value in list % 2 has a remainder (==) of zero
        output value

Now the trick is to use your desired language (c++), and convert it to the appropriate syntax. Good luck

Edited by pbj.codez

Votes + Comments
but +1 for algorithm
0

@pbj.codez I don't think it is right thing to define python as a "simple language". Using cpp wouldn't be overcomplicating, it is the same algorithm and probably 2 3 lines more. On the other hand, for this kind of tasks, it is more convenient to use any scripting language as they you don't have to compile anything in case you some small thing wrong and have to change smth.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.