Tool/software: Code Composer Studio
i am writing
if (a%2==0)
{
even;
}
else
{
odd;
}
here "a" is number which is in incrimental mode.
I also have dought that which header files required for exicute this code.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: Code Composer Studio
i am writing
if (a%2==0)
{
even;
}
else
{
odd;
}
here "a" is number which is in incrimental mode.
I also have dought that which header files required for exicute this code.
I did at search on Google and found this link:
http://stackoverflow.com/questions/160930/how-do-i-check-if-an-integer-is-even-or-odd
I tried running a slightly modified version of that on a F28069 and it works fine.
Regards,
John
I usually use "&1" to replace (%2).
if (a&1) {
// odd
} else {
// even
}
The efficiency should be better to use "&1".