How can i remove the tailing zeros from the return of a function? Here is the function, which is in another class.
static public double Area(double side1,double side2){
return side1*side2;
}
and here is the calling function
System.out.println("Side 1 : ");
b1=new Scanner(System.in);
double side1=b1.nextDouble();
System.out.println("Side 2: ");
b2=new Scanner(System.in);
double side2=b2.nextDouble();
System.out.println("Area= "+Rectangle.Area(side1, side2));
For side1=10 and side2=10 the output will be
Area = 100.0
while i want it to be
Area = 100
and for example for values 0.25 and 2 will be
Area = 0.5