Chuyển đổi từ nhiệt độ Fahreneit sang Selsius

Yêu cầu: Chuyển đổi từ nhiệt độ Fahreneit sang Selsius theo công thức:

C = 5*(F - 32) / 9
C: nhiệt độ C
F: nhiệt độ F

Phân tích: 

–  Nhập đầu vào từ bàn phím.

– Chuyển đổi từ nhiệt độ F sang nhiệt độ C theo công thức trên

– Hiển thị kết quả ra màn hình

Code:

/**********************Temperature convert********************
* Author: VNCODING
* History
* 2014/07/14        first create    VNCODING
*************************************************************/
#include <stdio.h>
#include <conio.h>

void main()
{
    float C = 0;
    float F;
    printf("\n Nhap vao nhiet do F = ");
    scanf("%f", &F);
    C = 5*(F - 32)/float(9);
    printf("\n Nhieu do Celcius = %f oC", C);
    getch();
}

Kết quả:

Nhap vao nhiet do F = 34
Nhiet do Celcius = 1.111111 oC

11 Comments on Chuyển đổi từ nhiệt độ Fahreneit sang Selsius

  1. cái dòng này là gì thế ạ
    /**********************Temperature convert********************
    * Author: VNCODING
    * History
    * 2014/07/14 first create VNCODING
    *************************************************************/

  2. Bai giai cua minh bang ngon ngu C++:
    #include
    #include
    #include
    using namespace std;

    int main()
    {
    double C;
    double F;
    cout <> F;
    C = (5*(F-32))/9;
    cout << C;
    return 0;
    }

  3. day la cua minh :
    #include

    int main()
    {
    int a ,b ;
    printf(“nhap vao day do f “);
    scanf(“%d”,&a);
    b=a*1.8+32;
    printf(“day la nhiet do c “);
    printf(“%d*1.8+32=%d”,a,b);
    return 0;
    }

Leave a Reply to ngô tiến đạt Cancel reply