2021年7月14日 星期三

Exercise 4-2

 


#include <stdio.h>

 

int main() {

    int r;

    printf("enter the radius: ");

    scanf("%d",&r);

    printf("the area of this circle is: %4.2f",r*r*3.14);

   

    return 0;

}

沒有留言:

張貼留言

如何於C程式內輸入字串?

之前我們學過如何於 C 程式內輸入數目字,但如要輸入字串,例如姓名,又要如何處理呢 ?   跟其他大部分電腦程言不一樣, C 並沒有一個字串的變數數據類型 (variable data type) , C 是使用字元 (character) 及變數陣列 (array)...