Skip to content

Commit a602d33

Browse files
committed
finding the number is odd or even
1 parent 7acd0bc commit a602d33

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

evenodd.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import java.util.Scanner;
2+
public class EvenOdd
3+
{
4+
public static void main (String args[])
5+
{
6+
Scanner scan=new Scanner(System.in);
7+
System.out.print("Enter the number: ");
8+
//reading value from user
9+
int num=scan.nextInt();
10+
//method calling
11+
findEvenOdd(num);
12+
}
13+
//user defined method
14+
void findEvenOdd(int num)
15+
{
16+
//method body
17+
if(num%2==0)
18+
System.out.println(num+" is even");
19+
else
20+
System.out.println(num+" is odd");
21+
}
22+
}

0 commit comments

Comments
 (0)