题解 | 数列求和
public class Main { public static void main(String[] args) { //write your code here........ long i=9; long sum=0; for(int count=0;count<10;count++){ sum+=i; i=i*10+9; } System.out.println(sum); } }
public class Main { public static void main(String[] args) { //write your code here........ long i=9; long sum=0; for(int count=0;count<10;count++){ sum+=i; i=i*10+9; } System.out.println(sum); } }
相关推荐