Skip to content

Instantly share code, notes, and snippets.

@JorgeOlvera
Created February 13, 2014 04:13
Show Gist options
  • Save JorgeOlvera/8969627 to your computer and use it in GitHub Desktop.
Save JorgeOlvera/8969627 to your computer and use it in GitHub Desktop.
// Calculate and return the area of a circle, given the radius.
import java.util.Scanner;
public class circleArea {
public static void main (String[] args){
Scanner input = new Scanner(System.in);
double radius = input.nextDouble();
radius = calculateArea(radius);
System.out.println(radius + " square cm ");
}
public static double calculateArea(double radius){
radius = (radius*radius)*3.141592;
return radius;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment