Lakkad Keyur R.
Lakkad Keyur R.
Lakkad Keyur R.
*/
import java.util.Scanner;
}
2./*Write a Java program to swap two numbers without taking the
third variable value
import java.util.Scanner;
marks and display the total and percentage. All values should be taken
from the
Scanner class.*/
import java.util.Scanner;
{
public static void main(String[]args)
int totalMark = 0;
mark[i]=prg.nextInt();
totalMark +=marks[i];
}
System.out.println("\nStudent Details:");
import java.util.Scanner;
}
4./*Write a Java program that will convert a float datatype into an int
data type. Perform
Type conversion */
int x = 5;
x++;
int y = 8;
y--;
}
7./*. Write a Java program to demonstrate the use of conditional
operators.
*/
}
8./*. Write a Java program to demonstrate the use of logical
operators.
*/
}
}
operators */
import java.util.Scanner;
prg.close();
blood. The conditions laid down are as under. Use if statement. a) Age
should be
above 18 yrs but not more than 55 yrs. b) Weight should be more than
45kgs.
*/
import java.util.Scanner;
} else {
prg.close();
double result;
switch (operator) {
case '+':
case '-':
break;
case '*':
break;
case '/':
if (num2 == 0) {
return;
break;
default:
System.out.println("Invalid operator!");
return;
*/
import java.util.Scanner;
if (year % 100 == 0) {
} else {
isLeapYear = true;
if (isLeapYear) {
} else {
prg.close();
23
456
7 8 9 10…….. so */
import java.util.Scanner;
int num = 1;
System.out.println();
// prg.close();
int divisor = 7;
int sum = 0;
if (num % divisor == 0) {
sum += num;
*/
import java.util.Scanner;
int reversedNumber = 0;
while (number != 0) {
number /= 10;
if (originalNumber == reversedNumber) {
} else {
}
//scanner.close();
percentage.
*/
import java.util.Scanner;
System.out.print("Subject 1: ");
System.out.print("Subject 2: ");
System.out.print("Subject 3: ");
String grade;
if (percentage >= 70) {
grade = "Distinction";
} else {
grade = "Fail";
// scanner.close();
if (number < 0) {
} else {
int factorial = 1;
int i = 1;
do {
factorial *= i;
i++;
// scanner.close();
import java.util.Scanner;
int n = prg.nextInt();
if (n <= 0) {
System.out.println("Invalid input! Please enter a positive
number.");
} else {
int count = 0;
int num = 2;
if (isPrime(num)) {
count++;
num++;
return false;
if (num % i == 0) {
return false;
return true;