백준 #26592번 Triangle Height

jhj·2024년 2월 16일

백준 JAVA

목록 보기
335/583
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		for(int i = 0; i < n; i++) {
			double a = sc.nextDouble();
			double b = sc.nextDouble();
			double h = (2 * a) / b;
			System.out.println("The height of the triangle is " + String.format("%.2f", h) + " units");
		}
		sc.close();
	}
}
profile
개발자를 꿈꾸는

0개의 댓글