Write java code Which allow a user to enter the radius of the circle then calculate the area? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Write java code Which allow a user to enter the radius of the circle then calculate the area?

11th Mar 2017, 5:00 AM
abdifatah said Salad
abdifatah said Salad - avatar
2 Answers
0
double area = Math.PI * r * r;
11th Mar 2017, 5:32 AM
Meharban Singh
Meharban Singh - avatar
0
import java.util.scanner class circle{ public static void main (String [] s){ Scanner sc = new Scanner (System.in); System.out.print("Enter radius: "); double r = sc.nextDouble (); double area = Math.PI *r * r; System.out.println ("Area = " + area); } }
11th Mar 2017, 5:53 AM
देवेंद्र महाजन (Devender)
देवेंद्र महाजन (Devender) - avatar