public class Sum { public static int count(int n) { if (n > 1) { return count(n - 1) + n; } else { return n; } } public static void main(String[] args) { System.out.println(Sum.count(100)); } }
原文地址:https://www.cnblogs.com/xieshilin/p/12244526.html
时间: 2024-10-04 08:46:00