Java代码实现1到100连乘,结果小于10000000000000停止
public class MultiplyNumbers { public static void main(String[] args) { long result = 1; for (int i = 1; i <= 100; i++) { result *= i; if (result >= 10000000000000L) { break; } } System.out.println('The result is ' + result); } }
原文地址: http://www.cveoy.top/t/topic/mf5x 著作权归作者所有。请勿转载和采集!