You are on page 1of 2

Practical No.

Q1] Write a program to make use of logical operators.

class percentage

public static void main(String args[])

int perc=Integer.parseInt(args[0]);

if(perc >=75)

System.out.println("Distiction");

else if((perc >=50) && (perc <75))

System.out.println("First class");

else if((perc >=35) && (perc<50))

System.out.println("Second class");

else if(perc <35)

System.out.println("Fail");

else

System.out.println("Absent");

} OUTPUT

}
Q2] Write a program to check no is even or odd.

Class Even

Public static void main(String args[])

int num=Integer.parseInt(args[0]);

if(num % 2 == 0)

System.out.println(“Number is Even”);

Else

System.out.println(“Number is Odd”);

OUTPUT:-

You might also like