+ 1

Help, write program for to check even or odd number using else statement

21st Oct 2020, 5:18 AM
Sada
4 Antworten
+ 6
1) take a number in an input 2) make an if else condition 3) in that condition, check if the remainder left when the number divided by 2 is zero or not, if it is, it is even coz it has no remainder left, otherwise it is odd.
21st Oct 2020, 5:46 AM
maf
maf - avatar
+ 1
Specify the language
21st Oct 2020, 5:22 AM
Gireesh Desineni
Gireesh Desineni - avatar
+ 1
int num; cin>>num; if(num%2==0) cout<<"Even Number"; else cout <<"Odd Number";
21st Oct 2020, 5:49 AM
Gireesh Desineni
Gireesh Desineni - avatar
0
C++
21st Oct 2020, 5:44 AM
Sada