Computer Science, asked by lakshayjain5451, 1 day ago

WAP to read numbers and display their squares, cubes, square roots, cube roots,
absolute value, ceiling value and floor value.

Answers

Answered by ItzMeSam35
4

import java.util.*;

public class Maths {

public static void main(String[] args) {

Scanner sc=new Scanner(System.in);

System.out.println("Please Enter a Value");

double a=sc.nextDouble();

double sq = a*a;

double cb = a*a*a;

double sqrt = Math.sqrt(a);

double cbrt = Math.cbrt(a);

double abs = Math.abs(a);

double ceil = Math.ceil(a);

double floor = Math.floor(a);

System.out.println("Square = "+sq);

System.out.println("Cube = "+cb);

System.out.println("Square Root = "+sqrt);

System.out.println("Cube Root = "+cbrt);

System.out.println("Absolute Value = "+abs);

System.out.println("Ceiling Value = "+ceil);

System.out.println("Floor Value = "+floor);

sc.close();

}

}

Attachments:
Similar questions