R4.18 on page 165.
How about printing out all digits of an integer in reverse order?
How about printing out all digits at even positions? For instance given 823456, you print out 6, 4, 2 but not 8 because 8 is the 5th digit. You see the right most digit is 0th.
How about printing out left half of the digits? If the total number of digits is odd, you print out the smaller half.
Challenge: 1) ACSL AscendingJr
I will test your code and let you know soon...
class pokeball {
public static void main(String[] args) {
double h1=6;
double h2=3;
double h3=2;
double r1=3;
double r2=2;
double area=(Math.PI*Math.pow(r1, 2)*h1)+(Math.PI*Math.pow(r2, 2)*h2)+(Math.PI*(Math.pow(r1, 2)+(r1*r2)+Math.pow(r2, 2))*h3/3);
}
}
Codiva says that there is a compilation error, but there were no red "x" marks and I looked it over and it looks fine.
int firstInt = (int) Math.log10(x);
int a = (int) (x / Math.pow(10, firstInt));
int b = x%10;
System.out.print("The outer digits are " + a + " and " + b);