Kód: Vybrat vše
import java.util.*;
public class XXX {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Zadej cele cislo: ");
int x = sc.nextInt();
System.out.println("---Vysledky---");
if (x < 0) {
System.out.print("tan(" + Math.abs(x) + ") = " + Math.tan(Math.toRadians(Math.abs(x))));
}
else if (x == 90) {
System.out.print("tangens nedefinovan");
}
else {
System.out.print("tan(" + x + ") = " + Math.tan(Math.toRadians(x)));
}
}
}
A u druhé podmínky kdy je tam zadáno x == 90 potřebuju, aby to neplatilo jen pro 90° ale pro všechny liché násobky 90°. 90, 270, 450, 630, ...