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); } }

16th Jun 2021, 9:35 AM
aniruddha upar
aniruddha upar - avatar
2 Respostas
+ 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.
16th Jun 2021, 9:48 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 2
Thank you!
16th Jun 2021, 9:50 AM
aniruddha upar
aniruddha upar - avatar