Calculate the circumference of a circle

  • 1
  • Locked
Well, we have a plan. Let's implement it. First, implement a method that calculates the circumference of a circle. To do this, you need to write the correct formula in the method and specify the arguments. But what about pi, which we know is 3.141592... and so on to infinity? We'll keep things simple: let pi = 3.14.
You can't complete this task, because you're not signed in.
Comments (23)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Anonymous #10793745
Level 2 , Cincinnati, United States
17 September, 11:51
Can someone please clarify why you must use "int radius" for the method and why it won't work with a double? I would assume that it would be the exact opposite, the instructions even say that the result should be a fractional double.
MathBechy
Level 2
2 July, 15:10
I love it!!!
Shadow
Level 3 , Denver, United States
2 April, 18:17
I did not have to declare any variables for it to pass... But what I am wondering is how the answer came out as a double, when only the data type int was used?
Java_Mooood
Level 3 , San Antonio, United States
12 October 2020, 20:00
declare 2 double variables in printCircleCircumference , pi and c print the c , second variable
Steven
Level 3 , United States
24 November 2020, 21:12
awesome :)
Velociraptor
Level 3 , Bangalore, India
23 July 2020, 09:28
This is not working the first condition is not satisfied
byron
Level 2 , Hammond, United States
17 May 2020, 08:41
Where do you all explain the lesson?
P S
Level 3 , United States
26 April 2020, 14:09
I'm a little mixed up myself. I got the same thing you did, but for some reason, it's not accepting my code. When I say System.out.print(C), i get 31.400000000000002, but when I say System.out.print(pi), I get 3.14. Am I doing something wrong?
P S
Level 3 , United States
28 April 2020, 13:57
And its also not working when I change the 'pi' value to .314. Can someone please help me?
Roman
Level 41
29 April 2020, 07:27
Please refer to Help section at our course.
Felix
Level 8 , Center Moriches, United States
24 December 2019, 07:01
I know my code is all out of wack but this generated a correct answer. Can anyone concur?
Thaddeus B Cornish Jr.
Level 3 , Nassau, Bahamas
11 November 2019, 18:39
What is wrong with my code?
Roman
Level 41
12 November 2019, 07:37
If you need help, something isn't right in your code, the server won't accept your solution (even if you are 100% sure that it is correct). Describe your question/issue in the HELP section at codegym.cc/help.
ZlatimirIvanov
Level 8 , Sofia, Bulgaria
7 May 2019, 16:45
I got this answer - 31.400000000000002. Why?