Practical File
Practical File
PROGRAMS OF JAVA
FOR
PRACTICAL FILE
CLASS -12
TERM-2
Program1: Write a program in Java to implement the formula: Volume = length * width * height.
import java.util.Scanner;
double l= Double.parseDouble(length);
double b= Double.parseDouble(breadth);
double h= Double.parseDouble(height);
double Volume=l*b*h;
Output
Program2: Write a program in Java to find the result of the following expressions. (Assume a = 20 and b = 30)
i) a%b
ii) a /= b
iv) a++
int a=20;
int b=30;
Output:
Program 3: Write a program in Java to print the square of every alternate number of an array
int [] numbers = {10, 20, 14, 12, 1, 8, 40, 90, 100, 7};
System.out.println(numbers[i]*numbers[i]);