// Arup Guha
// 9/10/2026
// Solution to Fall 2026 COP 3330 Exam #1 Questions #6

import java.util.*;

public class e1q6 {

	public static void main(String[] args) {
		System.out.println(getSideC(3,4,Math.PI/2));
		System.out.println(getSideC(3,4,2*Math.PI/3));
	}
	
	public static double getSideC(double a, double b, double angleC) {
		return Math.sqrt( Math.pow(a,2) + Math.pow(b,2) - 2*a*b*Math.cos(angleC) );
	}

}