Write a Java program to Find the hyperbolic sine of an angle


  • We import the java.util.* package to use the Scanner class for taking user input.
  • We create a public class called Hyperbolic_Sine.
  • We create the main method, which is the entry point of the program.
  • We declare a Scanner object called input to take user input.
  • We declare a double variable called deg and initialize it to 0.
  • We display a message asking the user to enter the degree of the angle.
  • We use the nextDouble() method of the Scanner class to read the user input and assign it to the deg variable.
  • We convert the degree value to its equivalent in radians using the toRadians() method of the Math class and assign it to the rad variable.
  • We calculate the hyperbolic sine of the angle using the sinh() method of the Math class, passing the rad value as an argument.
  • We display the result using the System.out.print() method.

The sinh() method returns the hyperbolic sine of a value, which is calculated as (e^x - e^-x)/2, where e is the mathematical constant approximately equal to 2.71828, and x is the input value in radians.

Source Code

import java.util.*;
public class Hyperbolic_Sine
{
	public static void main(String[] args)
	{
		Scanner input = new Scanner(System.in);
		double deg = 0;
 
		System.out.print("Enter The Degree : ");
		deg = input.nextDouble();
 
		double rad = Math.toRadians(deg);
		System.out.print("Hyperbolic Sine is : " + Math.sinh(rad));
	}
}

Output

Enter The Degree : 58.12
Hyperbolic Sine is : 1.1975213309842405

Example Programs