Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ check if number is even or odd

#include <iostream>
using namespace std;
int main() {
   int num = 7;
   if((num & 1) == 0)
   cout<<num<<" is even";
   else
   cout<<num<<" is odd";
   return 0;
}
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #check #number #odd
ADD COMMENT
Topic
Name
3+8 =