Created
January 2, 2014 15:09
-
-
Save Nick-Harvey/8220591 to your computer and use it in GitHub Desktop.
First Java App
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class MyFirstClass { | |
public static void main(String[] args) { | |
Scanner sc=new Scanner(System.in); | |
double PI=3.14; | |
double radius, area, circumference; | |
System.out.print("Enter the radius: "); | |
radius = sc.nextDouble(); | |
//Calculate the area | |
area = PI * radius * radius; | |
//Calculate the circumference | |
circumference = 2 * PI * radius; | |
//Print the area and the circumference of the circle | |
System.out.println("The area is "+area); | |
System.out.println("The Circumference is "+ circumference); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment