Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Write a program that enters the sides of a rectangle (two integers a and b)
- * and calculates and prints the rectangle's area. */
- import java.util.Scanner;
- public class _01_RectangleArea {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Scanner scan = new Scanner(System.in);
- System.out.println("Enter 2 positive Integer numbers for the sides of rectangle:");
- int sideA = scan.nextInt();
- int sideB = scan.nextInt();
- if (sideA > 0 && sideB > 0) {
- long rectangleArea = sideA * sideB;
- System.out.println("The Area of that rectangle is: " + rectangleArea);
- } else {
- System.out.println("Error! - Invalid Input!!!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement