+ 1
Need help here ?!
/*I try here to tell if number is odd or even it always print even*/ #include <iostream> using namespace std; int main() { float number=9 ; cout<<"Enter number to check if even or odd"; float x; x = number/2 ; int y; y = number/2 ; if (x==y) {cout<<"Even"; } else {cout<<"Odd"; } return 0; }
11 Answers
+ 2
try taking
float number =9.0
or x=number/2.0
+ 2
the condition u gave is wrong
put x==y
and it will work.đ
+ 2
plz follow me đ
+ 2
done ^_^
+ 1
it is a nice code. but what help do u need?
+ 1
it always print even
+ 1
Error still up
+ 1
what if u try taking both ?
float number =9.0
and x=number/2.0
+ 1
hey dude I got it...
the condition u gave is wrong.....
put x==y.....
so dumb of međ€
+ 1
i think when an odd divided by 2 fraction lost by int type
+ 1
fine ,i catch it now
thank u :)