JAVA Basic program(practical-2)
Java Code Examples with Comments prac 2.1. WAP to find a diameter from given area of circle. import java.util.Scanner; public class prac_2_1 { public static void main(String[] args) { Scanner SC = new Scanner(System.in); System.out.println("enter area"); Float a = SC.nextFloat(); // Input area of the circle System.out.println(Math.sqrt((a / 3.14)) * 2); // Calculate diameter using the area } } prac 2.2. WAP to check whether the given number is positive or negative. import java.util.Scanner; public class prac_2_2 { public static void main(String[] args) { Scanner SC = new Scanner(System.in); System.out.println("enter number"); int n = SC.nextInt(); // Input the number if (n > 0) { System.out.println("Number is positive"); } else if (n == 0) { System.out...