/*
Write a program by defining a function "even_odd" to test whether a given integer is even or odd.
Pass the integer value as a argument to function.
*/
#include <iostream>
using namespace std;
void even_odd(int);
int main()
{
int Num;
cout<< "Number: "; cin>>Num;
even_odd(Num);
return 0;
}
void even_odd(int Num)
{
if ( 0 == Num%2 ) //or u can write if(Num%2 == 0).
cout<<Num<<" is Even" << endl;
else
cout<<Num<<" is Odd" << endl;
}
If i want to return a value from defintion to call function .
ReplyDeleteThen what should i so.?
What will i do
ReplyDeleteWhen i will return a value in dumction definition