PLEASE SOLVE THE 6TH SUM
Answers
import java.util.Scanner;
public class KboatExpression
{
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
System.out.print("Enter the value of a: ");
int a = in.nextInt();
System.out.print("Enter the value of b: ");
int b = in.nextInt();
System.out.print("Enter the value of c: ");
int c = in.nextInt();
double exp = (1 / Math.pow(a, 2)) + (2 / Math.pow(b, 2)) + (3 / Math.pow(c, 2));
long roundedExp = Math.round(exp);
System.out.println("Result rounded to whole number: " + roundedExp);
}
}
Answer:
import java.util.Scanner;
import java.lang.Math;
public class Main
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter value for a:");
double a = sc.nextDouble();
double b = (2*a) + Math.cbrt(a);
System.out.println("The value for b when a is " + a + " is " + b);
}
}
Explanation: