Thursday 11 May 2017

Functions in c++ Part 3 [27]





#include<constream.h>

#include<iomanip.h>



int even(int);



void main(){

clrscr();

    cout<<"enter a number";

    int num1;

    cin>>num1;



   

   int result =  even(num1);

   

    if(result ==1)

        cout<<"even";

    else

        cout<<"odd";

getch();

}

int even(int num1)

{

    if(num1%2==0)

      return 1;

   

    return 0;



}

No comments:

Post a Comment