write a java program to input area of square and find its perimeter
Answers
Explanation:
import java.util.Scanner;
import java.lang.*
public class JavaProgram
{
public static void main(String args[])
{
int side, perimeter, area;
Scanner scan = new Scanner(System.in);
System.out.print("Enter Area of Square : ");
area = scan.nextInt();
side=Math.sqrt(area)
perimeter = 4*side;
System.out.print("\nPerimeter of Square is : = " +perimeter);
}
}
Output:
Enter Area of Square : 36
Perimeter of square is : 24
Answer:
Explanation:
import java.util.*;
class Q1
{
static void main()
{
double a,p,s;
Scanner sc=new Scanner(System.in);
System.out.println(“Enter the area of the square:”);
a=sc.nextDouble();
s=Math.sqrt(a);
p=4*s;
System.out.println(“Perimeter=”+p);
}
}
2. Write a program to input