Skip to content

Instantly share code, notes, and snippets.

@Kurt-P
Last active August 29, 2015 13:56
Show Gist options
  • Save Kurt-P/8847397 to your computer and use it in GitHub Desktop.
Save Kurt-P/8847397 to your computer and use it in GitHub Desktop.
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);
}
}
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);
}
}
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);
}
}
}
}
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