0
Challenge 2 Help
int a; cin>>a; if(a _ 2==0) cout <<"The number is even"; else cout <<"The number is odd"; What to put here?
1 Réponse
+ 1
% gives you the remainder of an euclidian division.
42%9 is 6 (since 42 is 9*4+6)
a%b is 0 if a is a multiple of b
a%1 is always 0
a%2 is 0 if a is even and 1 if a is odd
a%10 gives you the last digit of a
a%100 gives you the last two digits of a
etc.