Last active
August 29, 2015 13:56
-
-
Save Kurt-P/8847397 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 CircleCalc { | |
public static void main(String[] args) { | |
Scanner scanner = new Scanner(System.in); | |
double radius, area; | |
System.out.print("Area of the circle: "); | |
area = scanner.nextInt(); | |
radius = Math.sqrt((area/Math.PI)); | |
System.out.printf("Radius of your circle is %.2f units\n", radius); | |
} | |
} |
This file contains hidden or 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 Next { | |
public static void main(String[] args) { | |
Scanner scanner = new Scanner(System.in); | |
int x; | |
System.out.print("Enter a number: "); | |
x = scanner.nextInt(); | |
System.out.printf("You enterend the number %d\n", x); | |
} | |
} |
This file contains hidden or 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
public class Odd { | |
public static void main(String[] args) { | |
for (int i = 0; i <= 10; i++) { | |
if (i % 2 == 0) { | |
System.out.printf("%d is even\n", i); | |
} | |
else { | |
System.out.printf("%d is odd\n", i); | |
} | |
} | |
} | |
} |
This file contains hidden or 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
public class Tester { | |
public static void main(String[] args) { | |
double d1; | |
double degree1, degree2, r1, r2; | |
degree1 = 187.00; | |
degree2 = 122.00; | |
r1 = Math.toRadians(degree1); | |
r2 = Math.toRadians(degree2); | |
d1 = 3 * Math.PI * Math.sin(r1) + Math.abs(Math.cos(r2)); | |
System.out.println(d1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment