Java Program to Demonstrate the Math.CopySign() Method

You are currently viewing Java Program to Demonstrate the Math.CopySign() Method

Java program to demonstrate the Math.copySign() method

// Java program to demonstrate the 
// Math.copySign() method

import java.util.*;

public class Main {
  public static void main(String[] args) {
    double num = 0;

    num = Math.copySign(23.45, -45.67);

    System.out.print("Result: " + num);
  }
}

Output

Result: -23.45

Ranjith

Hi, I'm Manoj a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply