C++ int type Convert temperature from Celsius degrees into Fahrenheit

Introduction

Formula to convert temperature from Celsius degrees into Fahrenheit

Fahrenheit = Celsius  * (212 - 32)/100 + 32
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;

int main(int nNumberofArgs, char* pszArgs[])
{
    int celsius;//  w  w w  .j  ava2 s.c  om
    cout << "Enter the temperature in Celsius:";
    cin >> celsius;

    int factor;
    factor = 212 - 32;

    int fahrenheit;
    fahrenheit = factor * celsius/100 + 32;

    cout << "Fahrenheit value is:";
    cout << fahrenheit << endl;

    return 0;
}



PreviousNext

Related