| | |
EvenOdd
Please support our C# advertiser: Programming Forums - DaniWeb Sister Site
![]() |
Can't!!
Your question has words "OR" this means you've to use a branched code...
Your question has words "OR" this means you've to use a branched code...
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
•
•
•
•
I think Bitwise & operator can be useful.
No & 2 == 0 means Odd
and
No & 2 == 2 means Even
(here No is any number)
Is this correct?
I think it also using condition but different approach rather than modulus
No & 2 == 2 would return false for No = 0.
.
.
.
Modulus wins!
![]() |
Similar Threads
- Odd/Even Code (Java)
- sort even and odd numbers from an array (C++)
- sort even and odd numbers for an array (C)
- help (C++)
- Even / Odd code HELP!! (Java)
Other Threads in the C# Forum
- Previous Thread: Parsing a log file using regular expressions
- Next Thread: using print screen key
Views: 1078 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for C#
.net access algorithm array barchart bitmap box button buttons c# chat check checkbox class client code color combobox control conversion csharp custom database datagridview dataset datetime degrees draganddrop drawing encryption enum excel file files form format forms ftp function gcd gdi+ httpwebrequest image index input install java label list listbox listener login mandelbrot math mouseclick mysql networking object operator oracle path photoshop picturebox post prime programming radians regex remote remoting resource richtextbox save saving serialization server sleep socket sql statistics stream string table tcp text textbox thread time timer treeview update usercontrol validation view visualstudio webbrowser windows winforms wpf xml






