Code is copied!
Program to print absolute value of a number entered by the user JAVA
Write a Program to print absolute value of a number entered by the user.
import java.util.*;
class absolute
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
if(n < 0)
System.out.println((-1)*n);
else
System.out.println(n);
}
}