Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exercise_1_7 #50

Open
aplusdesigners opened this issue Jun 2, 2020 · 0 comments
Open

Exercise_1_7 #50

aplusdesigners opened this issue Jun 2, 2020 · 0 comments

Comments

@aplusdesigners
Copy link

I am not sure if it is an issue with the Java version I am coding on, an Eclipse issue or code issue. When I run the code in Exercise_1_7, it outputs 4.0 as both outputs. I have to change all instances of 1 to 1.0 in the fractions, like this:

`public class Exercise_1_7 {

public static void main(String[] args) {
	// TODO Auto-generated method stub
	System.out.println(4 * ( 1.0 - (1.0 / 3) + (1.0 / 5) - (1.0 / 7) + (1.0 / 9) - (1.0 / 11)));
	System.out.println(4 * ( 1.0 - (1.0 / 3) + (1.0 / 5) - (1.0 / 7) + (1.0 / 9) - (1.0 / 11) + (1.0 / 13)));
}

}`

My output is:
2.9760461760461765
3.2837384837384844

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant