Assignment No: 1 Date: 5/4/2024
Aim: To check if a number is even or odd.
Algorithm:
1. Take an integer input from the user.
2. Check if the number is divisible by 2.
3. If it is, print “Even”.
4. Otherwise, print “Odd”.
Code:
Import [Link];
Public class EvenOdd {
Public static void main(Str Scanner scanner=new Scanner([Link]);
[Link](“Enter a number: “);
Int num = [Link]();
If (num % 2 == 0) {
[Link](“Even”);
} else {
[Link](“Odd”);
}
*Variable Description:*
- `num`: The integer input from the user.
*Output:*
```
Enter a number: 10
Even
```
Or
```
Enter a number: 11
Odd
```
Please note that I’m a text-based AI and cannot generate images. I hope this text-based
representation helps!