跳到主要內容

程式設計-C語言 / OLD / 訊二甲( 江 ) / 上學期 / 1029-溫度轉換-p184

1

#include  <_ stdio.h_>
 
int main() {
    float c = 0, f = 0; //float = 實數
    while ( 1 ) {
        printf("\n 請輸入攝氏溫度 =>");
        scanf("%f", &c);
        f = (9.0 * c) / 5.0 + 32.0; 
        printf("華氏溫度 = %.1f\n" , f); 
    }
    return 0;
}
 
1 
 
#include  <= stdio.h =>
 
int main() {
    float c = 0, f = 0; //float = 實數
    while ( 1 ) {
        printf("\n 請輸 入 攝氏溫度 =>");
        scanf("%f", &c);
        f = (9.0 * c) / 5.0 + 32.0; 
        printf("華氏溫度 = %.1f\n" , f); 
        
        printf("\n 請輸 入 華氏溫度 =>");
        scanf("%f", &f);
        c = (5.0 / 9.0) * ( f - 32.0 ); 
        printf("攝氏溫度 = %.1f\n" , c); 
    }
    return 0;
}
 
 
 
 

 

時間類別單位標題發佈點閱
跳至網頁頂部