Another simple challenge.
Make all numbers negative except 0.
You have integers: 42, -9, 29, -32, 19, 0 .
Final data: -42, -9, -29, -32, -19, 0.
2/15/2018 1:36:01 PM
I took a break from my favourite C++ and wrote in Ruby:
Did you submit this as an assignment via lesson factory? It would be great if you could!
Here's another approach in C++, nice challenge. Thanks : )
Here is mine(Corrected):
My try :
Here's my try in c
Your solution is not perfectly correct :) ALL numbers must be negative. Your last negative number in list becomes positive. Try to fix it.
@A Z M Mushfiqur Rahman It is also not correct. You just rewrote it manually :) that's not good because when you add more numbers the code won't work.
Here is my code in a more mathematical approach. Good challenge for learners!
In Python - simple and straight:
@jay I'll do it few minutes later :)
@r8w9, correction is made in my code, please check now.
Mine, used Linq =)
@r8w9, thanks,I'm working on it.
My try in C++
Send us a message