Friday, January 9, 2015

Java program to print difference and quotient of 2 integer and double type numbers

public class SubDiv{
public static void main(String [] args){
int n1=9, n2=6, r1=0, r2=0;
r1=n1-n2;
System.out.println("Difference between 2 integer numbers is:"+r1);
r2=n1/n2;
System.out.println("Quotient of 2 integer numbers is:"+r2);

double num1=9, num2=6, r3=0, r4=0;
r3=num1-num2;
System.out.println("Difference between 2 double numbers is:"+r3);
r4=num1/num2;
System.out.println("Quotient of 4 double numbers is:"+r4);
}
}

No comments:

Post a Comment