Question: /* ----------------------------------------------------------- Write a function [2 mark] ----------------------------------------------------------- Write the function definition to complete the program. The program prompts the user to input an integer,
/*
-----------------------------------------------------------
Write a function [2 mark]
-----------------------------------------------------------
Write the function definition to complete the program.
The program prompts the user to input an integer, and then
reports whether the number is an odd or even number.
==========================
Sample Run:
Enter an integer: 5
It is an odd number.
==========================
Sample Run:
Enter an integer: 12
It is an even number.
==========================
---------------------------------------------------------------*/
#include
#include
using namespace std;
//-------------------------------------------------
// Write the function needed below.
//-------------------------------------------------
// Begin your answer here:
// Your answer ends here.
//*************************************************
// WARNING:
// Do not modify anything below this line.
// Any changes to the lines below will cause
// you to loose the mark for the question.
int main()
{
int num;
cout << "Enter an integer: ";
cin >> num;
if ( isEven(num) )
cout << " It is an even number. ";
else
cout << " It is an odd number. ";
return 0;
}
Write a program in C++
Please solve this question
Thankyou In advance
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
