Practical- No: 3
Write programs to demonstrate use of: if statements (all forms
of if statement Switch – Case statement Different & Loops)
1. Write a program to check multiple conditions using if statement along with logical
Code:
import java.util.Scanner;
class Logi
public static void main(String args[])
Scanner scanner = new Scanner(System.in);
System.out.print("Enter a number: ");
int num = scanner.nextInt();
if (num > 10 && num < 50) {
System.out.println("1");
} else {
System.out.println("0");
if (num % 2 == 0 || num % 3 == 0) {
System.out.println("1");
} else {
System.out.println("0");
if (!(num == 25)) {
System.out.println("1");
} else {
System.out.println("0");
}
Output: