Professional Documents
Culture Documents
Rollno-2102900100160*/
import java.util.Scanner;
int x=sc.nextInt();
if(x%2==0)
else
Rollno-2102900100160*/
import java.util.Scanner;
} else {
Rollno-2102900100160*/
import java.util.Scanner;
int a=sc.nextInt();
int b=sc.nextInt();
int c=sc.nextInt();
else{
/*Question4-WAP that a read a floating point number and prints zero if the number
is zero. Otherwise print negative or positive. */
Rollno-2102900100160*/
import java.util.Scanner;
if(num==0)
System.out.println("It is zero.");
else if(num>0)
System.out.println("It is positive");
else
System.out.println("It is negative:");
}
}
/*Question5-WAP that reads to floating number and test whether they are same upto
3 decimal places. */
Rollno-2102900100160*/
import java.util.Scanner;
float a = sc.nextFloat();
float b = sc.nextFloat();
if (a1 == b1)
System.out.println("equal");
else
System.out.println("not equal");
/*Question6-WAP that take 3 numbers as input and print "all are equal" if all are
equal, "all are different" if all 3 number are different and neither all or equal
or different " otherwise. */
import java.util.Scanner;
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
if (a == b && a == c) {
else
if (a != b && a != c && b != c) {
else {
}
/*Question7-WAP that takes 3 number as input and print increasing if the number
are in increasing order,decreasing if the numbers are in decreasing
order"otherwise. */
Rollno-2102900100160*/
import java.util.Scanner;
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
else
}
/*Question8-WAP to print day name of a weekday number starting sunday as day 1.*/
Rollno-2102900100160*/
import java.util.Scanner;
int no = sc.nextInt();
switch (no) {
case 1:
System.out.println("Sunday");
break;
case 2:
System.out.println("Monday");
break;
case 3:
System.out.println("Tuesday");
break;
case 4:
System.out.println("Wednesday");
break;
case 5:
System.out.println("Thursday");
break;
case 6:
System.out.println("Friday");
break;
case 7:
System.out.println("Saturday");
break;
default:
System.out.println("Invalid Input");
Rollno-2102900100160*/
import java.util.Scanner;
int a = sc.nextInt();
int b = sc.nextInt();
char ch = sc.next().charAt(0);
switch (ch) {
case '+':
break;
case '-':
System.out.println("Difference of " + a + " and " + b + ": " + (a - b));
break;
case '*':
break;
case '/':
break;
default:
System.out.println("Invalid Input:");