invalid operands of types 'float' and 'int' to binary 'operator%'

Hello everyone, its my first time in this forum, im new to arduino, i have an assignament due in 2 days, i need some help, im trying to make a program, using arrays and "for" cycles, where the user inserts 10 numbers using the monitor and then , gets shown back the odd numbers, ive done the code and im getting the error:

"invalid operands of types 'float' and 'int' to binary 'operator%'".

I've had 3, 1 hour 30 minutes classes about arduino and programing, most of the things i used for this code, i had to learn from the internet, the teacher gave each student a diffrent assignment, and just sort of told us to figure it out on our own, but it will be evaluated, so yeah i could really use the help.
Thanks in advance to anyone who takes the time to help me out.
Here is the code

float values[10];
int x = 0;
void setup() {
 // put your setup code here, to run once:
 Serial.begin(9600);
 for (x = 0; x < 10; x++) {
   Serial.println( "insirt a value");
   while (Serial.available() == 0) {}
   if (Serial.available() > 0) {
     values[x] = Serial.parseFloat();
   }
 }

 Serial.println(" the odd numbers are ");
 for (x = 0; x < 10; x++) {
   if ( values[x] % 2 == 1 ) {          
     Serial.println( values[x] );
   }
 }
 void loop() {
   // put your main code here, to run repeatedly:

 }

ive also tried values[x] & 1 == 1, gets me the error "invalid operands of types 'float' and 'bool' to binary 'operator&'"

Thanks in advance for any help :smiley:

...and that's why we ask you to use code tags when posting code.

AWOL:
...and that's why we ask you to use code tags when posting code.

Sorry! Its my first time here, i dont know what that is :confused:

You didn't read this?

Why not?
What could we have done to have made it more obvious?

The error messages are pretty self-explanatory.
The operators % and & are not defined for floating point datatypes.
Try integer datatypes instead.

AWOL:
The error messages are pretty self-explanatory.
The operators % and & are not defined for floating point datatypes.
Try integer datatypes instead.

I think i've fixed the code tags :smiley: , thanks, but is there a way to make it so it works with float datatypes?

is there a way to make it so it works with float datatypes?

Your question doesn't make any sense.

Is 2.35 odd or even?

How about 3.2?

Write out what you are expecting to see as the result of a float modulo 2. E.g. 134.62 % 2 = ? 134.63 % 2 = ?

Steve

CoDGAS:
I think i've fixed the code tags

You missed one part:

CoDGAS:
ive also tried values[x] & 1 == 1, gets me the error "invalid operands of types 'float' and 'bool' to binary 'operator&'"

That makes absolutely no sense because the forum interpreted some of your code as markup. If you had used code tags:

CoDGAS:
ive also tried

values[x] & 1 == 1

gets me the error "invalid operands of types 'float' and 'bool' to binary 'operator&'"

It would display as intended.