2019年6月26日 星期三

C語言(online c) (寫簡單的 程式 印出1..20 for do while 三種方式)

C語言(online c) (寫簡單的 程式 印出1..20 for do while 三種方式)

#include<stdio.h>
#include<math.h>
int main()
{
    for(int i=1;i<=20;i++)
        printf("%d\t",i);
    printf("\n"); 
   
    //===============
    int j=1;
    while(j<=20)
    {
        printf("%d\t",j);
        j++;
    }   
    printf("\n"); 
   
    //===============
    int k=1;
    do{
        printf("%d\t",k);
        k++;
    }while (k<=20);
   
   
    return 0;
}       


輸出畫面
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

沒有留言:

張貼留言

  清除項目編譯快取 執行 flutter clean 重新取得套件依賴 執行 flutter pub get 完整重新編譯並執行 flutter run 1. 新增專案套件 (pubspec.yaml) 在 Flutter 專案根目錄下的 pubspec.yaml 中,新增 ...