Write a program to input the side of a square and display the
length of the diagonal of square.. write accurately i have to type
Answers
Answered by
1
Answer:
import java.util.*;
class Diag{
public static void main (String ar []){
Scanner sc=new Scanner (System.in);
System.out.println("Enter side of a square");
int s=sc.nextInt();
System.out.println("Diagonal:"+(s*Math.sqrt(2)));
}
}
#Python
import math
s=(int)(input("Enter side of a square"))
print("Diagonal",(s*(math.sqrt(2))))
•Output Attached.
(Given input: 8)
Attachments:
Similar questions
Psychology,
17 days ago
Math,
17 days ago
Social Sciences,
17 days ago
Math,
1 month ago
English,
8 months ago
Math,
8 months ago
Social Sciences,
8 months ago