Open zhamri opened 4 years ago
import java.util.Scanner;
public class Perimeter{
public static void main(String[] args){
double length, width;
Scanner input = new Scanner(System.in);
System.out.println("Enter rectangle length: ");
length = input.nextDouble();
System.out.println("Enter rectangle width: ");
width = input.nextDouble();
double perimeter = 2 * (length + width);
System.out.println("Perimeter = " + perimeter + "cm");
input.close();
}
}
import java.util.Scanner;
public class PerimeterOfRec {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter Rectangle Length");
double length = scanner.nextDouble();
System.out.println("Enter Rectangle Width");
double width = scanner.nextDouble();
//perimeter = 2*(length+width)
double perimeter = 2*(length+width);
System.out.println("Perimeter of Rectangle = " + perimeter);
scanner.close();
}
}
import java.util.Scanner;
public class Perimeter{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
double l, w, per;
System.out.print("\nEnter rectangle length: ");
l=sc.nextDouble();
System.out.print("Enter rectangle width: ");
w=sc.nextDouble();
per = 2*(l+w);
System.out.println("Perimeter: "+ per);
sc.close();
}
}
/*Name:Ng Ke Rong*/
/*Matrik.No:271063*/
import java.util.*;
public class PerimeterOfRectangle{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
/*Input Length of Rectangle*/
System.out.print("Enter rectangle length\t\t:");
float length = input.nextFloat();
/*Input Width of Rectangle*/
System.out.print("Enter rectangle width\t\t:");
float width = input.nextFloat();
/*Output Perimeter of Rectangle*/
float perimeter = 2*(length+width);
System.out.println("\nTotal perimeter of rectangle\t:" +perimeter);
input.close();
}
}
import java.util.Scanner;
public class PerimeterOfARectangle {
public static void main(String[] args) {
float lenght,width;
Scanner input = new Scanner(System.in);
System.out.println("Enter rectangle length");
lenght = input.nextFloat();
System.out.println("Enter rectangle width");
width = input.nextFloat();
float perimeter = 2*(lenght+width);
System.out.println("Perimeter="+perimeter +"cm");
}
}
import java.util.Scanner;
public class HelloWorld{
public static void main(String [] args) {
int length;
int width, perimeter;
Scanner input = new Scanner(System.in);
System.out.println("Enter rectangle length: " );
length = input.nextInt();
System.out.println("Enter rectangle width: " );
width = input.nextInt();
perimeter = 2 * (length + width);
System.out.println("Perimeter: " + perimeter);
input.close();
}
}
import java.util.Scanner;
public class Perimeter {
public static void main (String[]args){
Scanner p= new Scanner(System.in);
System.out.println("Enter length of Rectangle:");
final double l= p.nextDouble();
System.out.println("Enter width of Rectangle:");
final double w= p.nextDouble();
final double perimeter = 2*(l+w);
System.out.println("Perimeter of Rectangle= "+perimeter);
p.close();
}
}
import java.util.Scanner;
public class perimeterofrectangle{
public static void main(String[]args){
Scanner in = new Scanner(System.in);
System.out.println("Enter rectangle length:");
double length = in.nextDouble();
System.out.println("Enter rectangle width:");
double width = in.nextDouble();
double perimeter = 2*(length + width);
System.out.print("Perimeter of rectangle=" + perimeter+"cm");
in.close();
}
}
import java.util.Scanner;
public class HelloWorld3{
public static void main(String[] args){
Scanner sc = new Scanner (System.in);
System.out.println("Enter rectangle length");
double length =sc.nextDouble();
System.out.println("Enter rectangle width");
double width =sc.nextDouble();
double perimeter =2*(length + width);
System.out.println("perimeter of rectangle=" + perimeter);
sc.close();
}
}
import java.util.Scanner;
public class perimeterofrectangle{
public static void main(String[]args){
Scanner in = new Scanner(System.in);
System.out.println("Enter the length of the Rectangle:");
Double l = in.nextDouble();
System.out.println("Enter the width of the Rectangle:");
Double w = in.nextDouble();
Double perimeter = 2 * (l+w);
System.out.println("Perimeter of Rectangle:" + perimeter);
in.close();
}
}
import java.util.Scanner;
public class Perimeter{
public static void main (String[] args){
float length, width;
Scanner input = new Scanner (System.in);
System.out.println ("enter the length : " );
length = input.nextFloat();
System.out.println ("enter the width : " );
width = input.nextFloat();
System.out.println ("the perimeter is : " );
System.out.print (2*(length + width));
input.close();
}
}
import java.util.Scanner; public class perimeterex1{
public static void main (String[] args) {
byte length, width ;
Scanner input = new Scanner ( System.in);
System.out.println ("enter the length : ");
length = input.nextbyte ();
System.out.println ("enter the width : ");
width = input.nextbyte ();
System.out.println ("the perimeter is :");
System.out.println ( 2* (length + width));
Scanner.close();
}
}
Instruction
Below is the
Pseudocode
to calculate the perimeter of a rectangle.Write a Java program to calculate the perimeter.
Submission