Thursday, July 9, 2009

Syntax of programme in c++ which gets a number from user and decide whether this number is even or odd?

Well go on, show us what it looks like.

Syntax of programme in c++ which gets a number from user and decide whether this number is even or odd?
No need to be a genius...


if ( int ( n / 2 ) == n / 2 )


even


else


odd





The rest is up to you
Reply:if (n % 2 == 1) {


n is odd


} else {


n is even


}


No comments:

Post a Comment