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

Recommended Answers

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.

Jump to Post

All 4 Replies

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.

Possibly silly question; does it even have to be in C++? I ask as you seem very lost.

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

commented: 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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.