Code:import java.math.*; class Stuff{ public static void main(String[] args) { int var4; var4 *= (3.14/180); // convert from degrees to radians; double sin_var4; for (int j = 5; j <= 10; j++){ sin_var4 += Math.pow(var4,j); } System.out.println(sin_var4); }}
Doesn't work... sigh always says sin_var4 0.
For those of you who might ask what sin_var4 is... (or what I am trying to do).
I am trying to write the defination of Sine function, which in Maclaurin series is x - x^3/3! + x^5/5! - ... x^n/n! + x^n/n! ... etc
and also seems like the compiler says sin_var4 is undefined.. why??





Reply With Quote