diff --git a/Basic/Check Whether a Number is Even or Odd/SolutionByGurirath.java b/Basic/Check Whether a Number is Even or Odd/SolutionByGurirath.java new file mode 100644 index 000000000..a9b506177 --- /dev/null +++ b/Basic/Check Whether a Number is Even or Odd/SolutionByGurirath.java @@ -0,0 +1,23 @@ + +/** + Write a number to check if it is even or odd. + */ +import java.util.*; +public class SolutionByGurirath +{ + public static void main(String args[]) + { + Scanner kb= new Scanner(System.in); + int n; + System.out.println("Enter a number to check if it is even or odd"); + n=kb.nextInt(); + if(n%2==0) + { + System.out.println("The number is even"); + } + else + { + System.out.println("The number is odd"); + } + } +}