/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package jv.arith;
/**
* Arithmetic identification in java
* @author sm rabbi
*/
public class JvArith {
//Demonstrate the basic arithmetic operators
public static void main(String[] args) {
// arithmetic usings integers
System.out.println("Integer Arithmetic");
int a=1+1;
int b=a*3;
int c=b/4;
int d=c-a;
int e=-a;
System.out.println("a= "+a);
System.out.println("b="+b);
System.out.println("c="+c);
System.out.println("d="+d);
System.out.println("e="+e);
//arithmatic using doubles
System.out.println("\nFloatig Piont Arithmetic");
double m=1+1;
double n=m*3;
double o=n/4;
double p=o-m;
double q=-p;
System.out.println("m="+m);
System.out.println("n="+n);
System.out.println("o="+o);
System.out.println("p="+p);
System.out.println("q="+q);
}
}
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package jv.arith;
/**
* Arithmetic identification in java
* @author sm rabbi
*/
public class JvArith {
//Demonstrate the basic arithmetic operators
public static void main(String[] args) {
// arithmetic usings integers
System.out.println("Integer Arithmetic");
int a=1+1;
int b=a*3;
int c=b/4;
int d=c-a;
int e=-a;
System.out.println("a= "+a);
System.out.println("b="+b);
System.out.println("c="+c);
System.out.println("d="+d);
System.out.println("e="+e);
//arithmatic using doubles
System.out.println("\nFloatig Piont Arithmetic");
double m=1+1;
double n=m*3;
double o=n/4;
double p=o-m;
double q=-p;
System.out.println("m="+m);
System.out.println("n="+n);
System.out.println("o="+o);
System.out.println("p="+p);
System.out.println("q="+q);
}
}
No comments:
Post a Comment