Java 1.2: area of rectangle I

areaOfRect1

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

    // area of rectangle

        int length;
        int height;
        int area;

        System.out.println("Enter a length: ");
        Scanner in = new Scanner(System.in);
        length = in.nextInt();

        System.out.println("Enter a height: ");
        height = in.nextInt();

        area = length * height;
        System.out.println("The area of your rectangle is " + area);
    }
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s