Java program to find perimeter of a rectangle
import java.util.Scanner; public class PerimeterOfRectangleDemo { public static void main(String []args) { float length, width, perimeter; Scanner sc = new Scanner(System.in); System.out.print("Please enter length of rectangle: "); length = sc.nextFloat(); System.out.print("Please enter width of rectangle: "); width = sc.nextFloat(); perimeter = 2 * (length + width); System.out.println("Perimeter of rectangle: " + perimeter); sc.close(); } }