Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Main {
- public static void main(String[] args) {
- /*
- can support decimal values: float and double
- integer types: byte short int long
- */
- //declaring variables
- double areaOfCircle;
- int areaOfRect;
- int length, width, radius;
- final double PI=Math.PI;
- //inputs
- length=15;
- width=24;
- radius=5;
- //calcs
- areaOfRect=length*width;
- areaOfCircle=radius*radius*PI;
- areaOfCircle=Math.pow(radius,2)*PI;
- //outputs
- System.out.println("Area of a rectangle with length: "+length+
- " and a witdth: "+width+ " is: "+areaOfRect);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement