/** * Triangle numbers: * Ancient Greek mathematicians under the leadership of Bida Costra discovered an interesting digital sequence 1, 3, 6, 10, 15, 21, ... * You can see what they have, what they have Is it regular? * By the way, the law is f (x) = x+ f (x-1) * Think about whether it is much like a plan to add from 1 to 100 when you were a kid */ Package Al; Public Class Triangle {Public Static Void Main ( String [] args) {triangle triangle = new triangle (); int result = triangle.getvalue (100); system.out.println ("result is" + result);} /*** m n No. N* @Return's triangular digital value*/ public int GetValue (int n) {if (n == 1) {Return 1;} else {Return n + getValue (n -1);}}}}