Computer Science, asked by alishan60, 21 days ago

write a Java program to input Length and Breadth of a rectangte to print Area and Perimeter.​

Answers

Answered by kamilkaja
0

Answer:

answer in attachment

Explanation:

please mark as brainlist

Attachments:
Answered by purveshKolhe
2

\huge{\red{\overbrace{\underbrace{\blue{\mathfrak{answer::}}}}}}

import java.util.Scanner;

public class RectInfo {

  public static void main(String [] args){

     Scanner sc = new Scanner(System.in);

     double length = sc.nextDouble();

     double breadth = sc.nextDouble();

     System.out.println("Area of the rectangle is - " + length * breadth);

     System.out.println("Perimeter of the rectangle is - " + 2 * (length + breadth));

  }

}

-----------------------------

\bf{\purple{\undeerline{Logic-}}}

  • We imported Scanner class for taking input from the user.
  • We declared class name as "RectInfo".
  • Then there is main method.
  • We activated the scanner.
  • We took input in two variables as length and breadth respectively.
  • We printed them using the println() method.
  • And finished it...

Hope it helps...

Similar questions