0
I need help with 2πr - Write a small program that will calculate and print the perimeter of a circle for you.
My faulty code below: import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); double pi = 3.14; //your code goes here p = scanner.nextline(); double newVar = p * pi * pi; System.out.println("The perimeter of a circle is: " + newVar); } }
3 Respuestas
+ 3
Harrison Rogers
Why there is pi * pi ?
Check formula again
2PI doesn't mean PI * PI it is 2 * PI
+ 2
2πr means 2 * pi * r
not pi^2 *r
+ 1
Thank you for the help.