亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

java+myeclipse 數字輸出

java+myeclipse 數字輸出

慕的地8271018 2018-07-04 09:22:28
問題:有兩組范圍數字:474~514,783~813兩組范圍數字(**范圍數字會變化**)。實際范圍數字有很多組,且數字范圍變化通過程序處理,輸出格式為:474,475,476,477,478,479,480481,482,483,484,485,486,487,488,489,490491,492,493,494,495,496,497,498,499,500501,502,503,504,505,506,507,508,509,510511,512,513,514783,784,785,786,787,788,789,790791,792,793,794,795,796,797,798,799,800801,802,803,804,805,806,807,808,809,810811,812,813
查看完整描述

1 回答

?
手掌心

TA貢獻1942條經驗 獲得超3個贊

public class Test {public static void main(String[] args) {
    for (int i = 474; i <= 514; i++) {
        if (i != 514) {
            if(i%10==0){
                System.out.print(i);
                System.out.println("");
            }else{
            System.out.print(i + ",");
            }
        } else {
            System.out.print(i);
        }
    }
    System.out.println("");



    for (int i = 783; i <= 813; i++) {
        if (i != 813) {
            if(i%10==0){
                System.out.print(i);
                System.out.println("");
            }else{
            System.out.print(i + ",");
            }
        } else {
            System.out.print(i);
        }
    }
}
}


查看完整回答
反對 回復 2018-08-05
  • 1 回答
  • 0 關注
  • 627 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號