find and display the diagonal of a square
taking side of square as an input.
Answers
Answered by
7
Answer:
//Java
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))))
•Required Output Attached
Attachments:
Answered by
2
Explanation:
import java.util.Scanner;
public class Diagonal
{
public static void main(String[ ] args)
{
Scanner scn = new Scanner(System.in);
System.out.println("Enter a diagonal of a square")
int a = scn.nextInt();
System.out.println("Diagonal="+(s*Math.sqrt(2)));
}
}
Similar questions
English,
1 month ago
CBSE BOARD X,
1 month ago
English,
1 month ago
Biology,
2 months ago
History,
2 months ago
English,
10 months ago
English,
10 months ago
Environmental Sciences,
10 months ago