Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

if even number c++

#include <iostream>
using namespace std;

int main() {
  int n;

  cout << "Enter an integer: ";
  cin >> n;

  if ( n % 2 == 0)
    cout << n << " is even.";
  else
    cout << n << " is odd.";

  return 0;
}
 
PREVIOUS NEXT
Tagged: #number
ADD COMMENT
Topic
Name
1+2 =