AnthonyPerez5886 AnthonyPerez5886
  • 18-10-2019
  • Computers and Technology
contestada

Write a function negateOdds that takes a list of integers and returns a list of integers with all of the odd integers negated. negateOdds :: [Integer] -> [Integer]

example: [1,2,3,4,5] should return [-1,2,-3,4,-5]

Respuesta :

bergintonatcapot18z8
bergintonatcapot18z8 bergintonatcapot18z8
  • 18-10-2019

Is this computer science?

If so, then the function you would need for your code is this...

_____

if (someValue%2 != 0) {

 value *= -1;

        }

_____

//basically number%2 == 0 means even so "!" means false so "not even" meaning "odd."

Assuming you are doing an array list (given a set value) or a for-loop with an

int someValue = Integer.parseInt(args[i]); inside (not given a set value and not restricted)

Otherwise ignore me....lol

Answer Link

Otras preguntas

Your model locomotive is 16 inches long. It is an exact model of a locomotive that is 40 feet long. A window on the locomotive is how many times wider than a wi
How many parrallel lines does a triangle,square,trapezoid,pentagon
Your model locomotive is 16 inches long. It is an exact model of a locomotive that is 40 feet long. A window on the locomotive is how many times wider than a wi
Who knows the book Rose Blanche
a store mixes red fescue worth $12 per pound and chewings fescue worth $16 per pound. The mixture is to sell for $15 per pound. Find out how much of each should
Does the green tea have coffein ???
Does the green tea have coffein ???
The coordinates of the vertices of ANGLE PQR are P(-3,3), Q(2,3), and R(-3,-4). Find the side lengths to the nearest hundredth and the angle measures to the nea
How to make money quickly
Who knows the book Rose Blanche