0

Can you help with me create a java program that converts an even number to odd number

Java program

28th Jan 2021, 12:35 PM
Mpho Sydwell
4 ответов
+ 6
Yes sure, first your attempt please.
28th Jan 2021, 12:35 PM
Aditya
Aditya - avatar
+ 3
Logic is that if(number is %2==0) number +=1;
28th Jan 2021, 1:26 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
0
int x = number%2==0?number+1:number;
28th Jan 2021, 5:52 PM
D_Stark
D_Stark - avatar