Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Write a program to enter a number and check and print whether the number is even or odd

What I have tried:

Java
int n,r
n=in.nextInt();
while(n>0)
{
r=n%10;
n=n%10;
}
if(n%2==0)
Posted
Updated 19-Dec-22 4:25am
v2
Comments
Richard MacCutchan 19-Dec-22 9:49am    
Do you have a n actual question? Also are you sure this is C++?

1 solution

 
Share this answer
 
Comments
jeron1 19-Dec-22 11:29am    
That's the follow-up question, "Can you convert this Java code to c++?" LOL

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900