Advertisement
thotfrnk

methods1.java

Dec 7th, 2022 (edited)
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class number1 {
  3.     public static void main(String[] args) {
  4.  
  5.         Scanner input = new Scanner (System.in);
  6.  
  7.         int length, breadth;
  8.  
  9.         System.out.println("Length: ");
  10.         length = input.nextInt();
  11.  
  12.         System.out.println("Breadth: ");
  13.         breadth = input.nextInt();
  14.  
  15.         //int area = area(5,6);
  16.         System.out.printf("Area of rectangle: %d", area(length, breadth));
  17.     }
  18.  
  19.     public static int area(int length, int breadth ) {
  20.         int area;
  21.         area = length * breadth;
  22.         return area;
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement