- 3

Write a C++ while clause that stops the loop when the value in the variable called even variable is not an even number

30th Jul 2021, 6:44 PM
Elvis Noko Kgomo
Elvis Noko Kgomo - avatar
2 Answers
+ 1
What is your attempt?
30th Jul 2021, 7:06 PM
Daniel Briceño
Daniel Briceño - avatar
0
It is simple to do. You just have to divide by two using the rest of the division: void msg_is_even( int number ){ printf( "the number: '%d' ",number ); if ( !number%2 ){// number==0 printf( " Is even" ); }else{ printf( " Not is even" ); } } number=2;//2 is even. msg_is_even( number ); number++;//3 not is even. msg_is_even( number );
30th Jul 2021, 7:18 PM
Daniel Briceño
Daniel Briceño - avatar