Area of Circle
int based datatype
Floating points area of circle |Area of cricle using decimal types | real types | floating points
public class RealNumbers { public static void main( String [] args ) { double d; // range two power 64 float f ; //range two power 32 d=3.140000000000000000000000000000002d; f=6.5f; float f1= 1.234567890122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222f; System.out.println("float f1:\n" + f1); System.out.println("double: \n" + d); // compute area of circle pie r square double pietop= 22.00d; double piedwon=7.0d; double r = 3d; System.out.println("AREA OF CIRCLE OF RADIUS 3 is "); System.out.println(((pietop/piedwon) * r* r)); System.out.println("--------------------------------"); } /* * * out put of the program float f1: 1.2345679 double: 3.14 AREA OF CIRCLE OF RADIUS 3 is 28.285714285714285 -------------------------------- */ }
Please send comments to
vgdarur.javafive@blogger.com
Copyright © 2008 - iForeRunner.com
http://www.iforerunner.com/