Computer Science, asked by swarajsamantapkt99, 1 day ago

How do i check whether any random number A is odd or even in java, without using if-else or switch-case

Answers

Answered by dbthakkar231979
2

Answer:

include<stdio. h> main() { int n; char *arr[2] = {"Even", "Odd"}; printf("Enter a number: "); //take the number from the user scanf("%d", &n); (n & 1 && printf("odd"))|| printf("even"); //n & 1 will be 1 when 1 is present at LSb, so it is odd. }

Similar questions