Category : Java | Sub Category : Data type, Variable and Arays | By Prasad Bonam Last updated: 2020-09-28 08:53:18 Viewed : 531
DESCRIPTION: In this program first declare a class name Area and show main program and than I declare pi r and b and delare value of r and pi after we declare how area found after this in system.out.println line it gives us the value of area
Source Code:
/**
*
* Write a program that
calculates the area of a circle, use data type of double.
*
*/
public class
Area { // This line daclare a new class & the class defination is start.
public static void
main(String a[]) { // This line begins the main() method.
double
pi, r, b; // daclere three variable of type double.
r = 12.3993; //
radius of circle.
pi = 3.1416; //
value of pi
b = pi * r * r; //
Declare area formula.
System.out.println("Area
of the circle is " + b); // This print the area of circle.
}
}