}
}
}
第七题:
public class disanzhangxiti7 { public static void main(String args[]) { long sum=0,a=8,item=a,n=10,i=1; for(i=1;i<=n;i++) { sum=sum+item; item=item*10+a; } System.out.println(sum); } }
public class disanzhangxiti7_while { public static void main(String args[]) {
}
}
long sum=0,a=8,item=a,n=10,i=1; while(i<=10) { i++; sum=sum+item; item=item*10+a; }
System.out.println(sum);
第八题:
public class disanzhangxiti8 { public static void main(String agrs[]) { int sum=0,i,n=1; for(i=1;i<=n;i++) { sum=sum+i; if(sum<8888) n++; if(sum>=8888)break; } System.out.println(\ System.out.println(\ } }