Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java

Java algorithm

Can someone explain to me what they want me to do? I missed 3 weeks tutorial , learning Java, this is very different from what i have learned at treehouse. here they are:

Split a two digit number

Given an integer between 0 and 99, write an algorithm to split it into the number of tens and number of units.

0.3 Arithmetic expressions

Write suitable expressions to do the following calculations:

Sum of the digits of two-digit number stored in num Half of doub1 plus a quarter of doub2 (doub1 and doub2 both have type double) The last digit of the sum of num1, num2, num3, num4 (these are all int) (for example, if the four numbers were 11, 22, 33 and 45 then the result should be 1, which is the last digit of 111).

1 Answer

Hi,

The treehouse JAVA Course only teach you the language but not algorithm, the algorithm is used for all the programming language not only JAVA. The following code is the split digit number. Hope it can help you.

public class test{
  public static void main(String[] args){
    int num = 99;

    for (int i=0; i<=num; i++){
      System.out.printf("For number %d, the tens is %d, the unit is %d\n", i, i/10, i%10);
    }
  }
}

Lol, i don't even understand this even if i believe you got this right. Well I don't understand it sadly. I wonder what book i can look into to understand this concept