C語言變量的輸出

#include <stdio.h>
int main()
{
    int n = 100;
    char c = '@';  //字符用單引號包圍,字符串用雙引號包圍
    float money = 93.96;
    printf("n=%d, c=%c, money=%f\n", n, c, money);

    return 0;
}

\n表示換行

//後面的爲註釋。註釋用來說明代碼是什麼意思,讓我們閱讀更加方便,它也是代碼的一部分。編譯器會忽略註釋內容。


 不用變量直接輸出的結果也是一樣的


  #include <stdio.h>

  1. int main()

  2. {

  3. float money = 93.96;

  4. printf("n=%d, c=%c, money=%f\n", 100, '@', money);


  5. return 0;

  6. }


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章