Identify Odd or Even Number in a way is using bit-wise Operator.
import java.util.Scanner; public class EvenOdd { public static void main(String[] args) { Scanner scan = new java.util.Scanner(System.in); System.out.println("Enter the number: "); int number=scan.nextInt(); //condition used to identify number is odd or even if((number/2)*2==number) { System.out.println(number + " is Even number"); } else { System.out.println(number + " is odd number"); } } } Output: Enter the number: 64 64 is Even number
- Write a program to find Number is a Odd number or Even number in simple way.
- Identify Odd or Even Number in a way is using bit-wise Operator.
- Write a program to find Number is a Odd number or Even number using Array.
- Write a program to find Number is a Odd number or Even number from 1 to N.
- Write a program to find Number is a Odd number or Even number From Given Range.
-
Write a program to find Number is a Odd or Even from 1 to N using while loop.
- Write a program to find Number is a Odd or Even from 1 to N using do-while loop.
No comments:
Post a Comment
If you have any doubts, please let me know