Program the following in Java language.
Implement the following equation
3x4sin(180x) + 4x3 cos(90x) + x2sin(tan(45)) + 7x + 9cos(90x2 )
where x may be user defined value.
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
double x = Math.toRadians(new Scanner(System.in).nextDouble());
System.out.println(3 * x * 4 * Math.sin(180 * x)
+ 4 * x * 3 * Math.cos(90 * x)
+ x * 2 * Math.sin(Math.tan(Math.toRadians(45)))
+ 7 * x
+ 9 * Math.cos(90 * x * 2));
}
}
Comments
Leave a comment