0
Circumference of circle
Please help me with this code, stuck on it since yesterday import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); double pi = 3.14; int radius =2 ; int result = 2*radius *math pi ; System.out.PrintIn(result); } }
2 Antworten
+ 3
You have done some mistakes:
1.You have written *math pi ,but you declared only pi as double and also you declared it next line .Next you declared int result but it should be double because you are insertng a double variable type .For this you will get an error.So the line should be:
double result=2*radius*pi;
2.You have written
System.out.PrintIn(result);
to print the variable.
This is totally wrong .First the "p" of print should be lowercase .Remember Java is case sensitive .Next
in PrintIn you have written "I" which is i in lowercase.But it should be "l" which is L in uppercase.
So the line should be:
System.out.println(result);
Hope it helps.
Also no need to write the line:
Scanner scanner......
because you are not taking input from the user.
+ 2
Thank you!