2.
Check Even or Odd
import [Link];
class EvenOdd {
public static void main(String[] args) {
Scanner scanner = new Scanner([Link]);
[Link]("Enter a number: ");
int num = [Link]();
if (num % 2 == 0) {
[Link](num + " is even.");
} else {
[Link](num + " is odd.");
}
}
}
3. Find the Largest of Three Numbers
import [Link];
class LargestNumber {
public static void main(String[] args) {
Scanner sc = new Scanner([Link]);
[Link]("Enter first number: ");
int num1 = [Link]();
[Link]("Enter second number: ");
int num2 = [Link]();
[Link]("Enter third number: ");
int num3 = [Link]();int largest = (num1 > num2) ? (num1 > num3 ? num1 : num3) :
(num2 > num3 ? num2 : num3);
[Link]("The largest number is: " + largest);
}
}