Tuesday, March 18, 2008

Program to demonstrate the addition and subtraction of double numbers

/* Program to demonstrate the addition and subtraction of double numbers*/


class AddSubDoubles
{

public static void main (String args[])
{

double x = 7.5;
double y = 5.4;

System.out.println("x is : " + x);
System.out.println("y is : " + y);

double z = x + y;
System.out.println("x + y is : " + z);

z = x - y;
System.out.println("x - y is : " + z);

}

}

No comments: