fill in the blanks to find out whether the value of "a" is an odd number or even number | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

fill in the blanks to find out whether the value of "a" is an odd number or even number

int a; cin>>a; if(a_2==0) cout<<"the number is even"; else cout<<"the number is odd";

12th Sep 2016, 3:13 PM
rohtan singh
4 Answers
+ 3
The answer is '%'; the modulus operator. The modulo returns the remained of a division e.g. 10 % 3 = 1 7 % 5 = 2 30 % 9 = 3
12th Sep 2016, 3:20 PM
Cohen Creber
Cohen Creber - avatar
+ 1
%
13th Sep 2016, 1:34 PM
Twinkle Baisane
Twinkle Baisane - avatar
0
%
12th Sep 2016, 4:08 PM
Kanuj Chitranshu
Kanuj Chitranshu - avatar
0
int a; cin>>a; if(a%2==0) cout<<"the number is even"; else cout<<"the number is odd";
12th Sep 2016, 4:24 PM
Waqar Ali
Waqar Ali - avatar