In java, how to get input from user? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

In java, how to get input from user?

During your math class, you are given a task to calculate the perimeter of a circle. You decide to write a small program that will take the radius as input, and will calculate and print the perimeter for you. The value for π (pi) is already defined. Sample Input 4 Sample Output 25.12

25th Aug 2021, 10:52 AM
Amala Yakin
1 Answer
+ 1
Scanner myScanner = new Scanner(System.in); System.out.println(2*3.14*myScanner.nextInt());
25th Aug 2021, 11:06 AM
SAN
SAN - avatar