Hogyan lehet Celsiust Fahrenheitre konvertálni

Hogyan lehet Celsiust Fahrenheitre konvertálni

A Celsius -Fahrenheit és a Fahrenheit -Celsius -konverzió valószínűleg a legzavaróbb átalakítás. De könnyen át tudja alakítani a hőmérsékletet, ha megfelelően érti az átalakítás folyamatát.





windows 10 első tennivalók

Ebben a cikkben megtudhatja, hogyan kell a Celsius-fokos hőmérsékletet Fahrenheit-fé alakítani-és fordítva.





Hogyan lehet a Celsius -fokot Fahrenheit -fokra konvertálni

A Celsius -fokban mért hőmérsékletet Fahrenheit -fokra alakíthatja át a következő képlet segítségével:





T(°F) = T(°C) × 9/5 + 32

Meg kell szorozni a ° C hőmérsékletet 9/5 -tel, és hozzá kell adni 32 -et. Az eredmény ° F -ban lesz.

Problémajelentés

Hőmérsékletet ad az egyiken ° C -ban, akkor át kell alakítani ° F -ra. 1. példa : Legyen szám = 100. Ezért a hőmérséklet ° F = (100 x 9/5) + 32 = 212 így a kimenet 212. 2. példa : Legyen szám = 0. Ezért a hőmérséklet ° F = (0 x 9/5) + 32 = 32 Így a kimenet 32.



C ++ program a Celsius -fok Fahrenheit -fokra történő konvertálására

Az alábbiakban található a C ++ program Celsius -Fahrenheit -konverzióhoz:

// C++ program to convert temperature in Celcius to Fahrenheit
#include
using namespace std;
// Function to convert temperature in Celcius to Fahrenheit
float celciusToFahrenheit(float num)
{
return ((num * 9.0 / 5.0) + 32.0);
}
int main()
{
float num1 = 100.0;
cout << 'Temperature in Celcius: ' << num1 << endl;
cout << 'Temperature in Fahrenheit: ' << celciusToFahrenheit(num1) << endl;
float num2 = 0;
cout << 'Temperature in Celcius: ' << num2 << endl;
cout << 'Temperature in Fahrenheit: ' << celciusToFahrenheit(num2) << endl;
float num3 = 65.0;
cout << 'Temperature in Celcius: ' << num3 << endl;
cout << 'Temperature in Fahrenheit: ' << celciusToFahrenheit(num3) << endl;
float num4 = 150.0;
cout << 'Temperature in Celcius: ' << num4 << endl;
cout << 'Temperature in Fahrenheit: ' << celciusToFahrenheit(num4) << endl;
float num5 = 20.0;
cout << 'Temperature in Celcius: ' << num5 << endl;
cout << 'Temperature in Fahrenheit: ' << celciusToFahrenheit(num5) << endl;
return 0;
}

Kimenet:





Temperature in Celcius: 100
Temperature in Fahrenheit: 212
Temperature in Celcius: 0
Temperature in Fahrenheit: 32
Temperature in Celcius: 65
Temperature in Fahrenheit: 149
Temperature in Celcius: 150
Temperature in Fahrenheit: 302
Temperature in Celcius: 20
Temperature in Fahrenheit: 68

Python program Celsius -fok Fahrenheit -fokra történő konvertálására

Az alábbiakban található a Python program Celsius -Fahrenheit konverzióhoz:

# Python program to convert temperature in Celcius to Fahrenheit
# Function to convert temperature in Celcius to Fahrenheit
def celciusToFahrenheit(num):
return ((num * 9.0 / 5.0) + 32.0)
num1 = 100.0
print('Temperature in Celcius:', num1)
print('Temperature in Fahrenheit:', celciusToFahrenheit(num1))
num2 = 0
print('Temperature in Celcius:', num2)
print('Temperature in Fahrenheit:', celciusToFahrenheit(num2))
num3 = 65.0
print('Temperature in Celcius:', num3)
print('Temperature in Fahrenheit:', celciusToFahrenheit(num3))
num4 = 150.0
print('Temperature in Celcius:', num4)
print('Temperature in Fahrenheit:', celciusToFahrenheit(num4))
num5 = 20.0
print('Temperature in Celcius:', num5)
print('Temperature in Fahrenheit:', celciusToFahrenheit(num5))

Kimenet:





Temperature in Celcius: 100.0
Temperature in Fahrenheit: 212.0
Temperature in Celcius: 0
Temperature in Fahrenheit: 32.0
Temperature in Celcius: 65.0
Temperature in Fahrenheit: 149.0
Temperature in Celcius: 150.0
Temperature in Fahrenheit: 302.0
Temperature in Celcius: 20.0
Temperature in Fahrenheit: 68.0

Összefüggő: A FizzBuzz kihívás teljesítése 5 programozási nyelven

JavaScript program a Celsius -fok Fahrenheit -fokra történő konvertálására

Az alábbiakban található a JavaScript program Celsius -Fahrenheit -konvertáláshoz:

// JavaScript program to convert temperature in Celcius to Fahrenheit
// Function to convert temperature in Celcius to Fahrenheit
function celciusToFahrenheit(num) {
return ((num * 9.0 / 5.0) + 32.0);
}

var num1 = 100.0;
document.write('Temperature in Celcius: ' + num1 + '
');
document.write('Temperature in Fahrenheit: ' + celciusToFahrenheit(num1) + '
');
var num2 = 0;
document.write('Temperature in Celcius: ' + num2 + '
');
document.write('Temperature in Fahrenheit: ' + celciusToFahrenheit(num2) + '
');
var num3 = 65.0;
document.write('Temperature in Celcius: ' + num3 + '
');
document.write('Temperature in Fahrenheit: ' + celciusToFahrenheit(num3) + '
');
var num4 = 150.0;
document.write('Temperature in Celcius: ' + num4 + '
');
document.write('Temperature in Fahrenheit: ' + celciusToFahrenheit(num4) + '
');
var num5 = 20.0;
document.write('Temperature in Celcius: ' + num5 + '
');
document.write('Temperature in Fahrenheit: ' + celciusToFahrenheit(num5) + '
');

Kimenet:

Temperature in Celcius: 100
Temperature in Fahrenheit: 212
Temperature in Celcius: 0
Temperature in Fahrenheit: 32
Temperature in Celcius: 65
Temperature in Fahrenheit: 149
Temperature in Celcius: 150
Temperature in Fahrenheit: 302
Temperature in Celcius: 20
Temperature in Fahrenheit: 68

Hogyan lehet a Fahrenheit -féle hőmérsékletet Celsius -ba konvertálni

A Fahrenheit -fokban mért hőmérsékletet Celsiusra alakíthatja a következő képlet segítségével:

T(°C) = (T(°F) - 32) × 5/9

A 32 F -et ki kell vonni a ° F hőmérsékletből, majd meg kell szorozni 5/9 -el. Az eredmény ° C -ban lesz.

Problémajelentés

Hőmérsékletet ad az egyiken ° F -ban, akkor át kell alakítani ° C -ra. 1. példa : Legyen szám = 212. Ezért a hőmérséklet ° C = (212 - 32) x 5/9 = 100 Így a kimenet 100. 2. példa : Legyen szám = 32. Ezért a hőmérséklet ° C = (32 - 32) x 5/9 = 0 Így a kimenet 0.Összefüggő: Hogyan találja meg a karakter ASCII értékét?

C ++ program a Fahrenheit hőmérséklet Celsius -fokra történő konvertálására

Az alábbiakban a C ++ program található Fahrenheit -Celsius -konverzióhoz:

// C++ program to convert temperature in Fahrenheit to Celcius
#include
using namespace std;
// Function to convert temperature in Fahrenheit to Celcius
float fahrenheitToCelcius(float num)
{
return ((num - 32.0) * 5.0 / 9.0);
}
int main()
{
float num1 = 212;
cout << 'Temperature in Fahrenheit: ' << num1 << endl;
cout << 'Temperature in Celcius: ' << fahrenheitToCelcius(num1) << endl;
float num2 = 32;
cout << 'Temperature in Fahrenheit: ' << num2 << endl;
cout << 'Temperature in Celcius: ' << fahrenheitToCelcius(num2) << endl;
float num3 = 149;
cout << 'Temperature in Fahrenheit: ' << num3 << endl;
cout << 'Temperature in Celcius: ' << fahrenheitToCelcius(num3) << endl;
float num4 = 302;
cout << 'Temperature in Fahrenheit: ' << num4 << endl;
cout << 'Temperature in Celcius: ' << fahrenheitToCelcius(num4) << endl;
float num5 = 68;
cout << 'Temperature in Fahrenheit: ' << num5 << endl;
cout << 'Temperature in Celcius: ' << fahrenheitToCelcius(num5) << endl;
return 0;
}

Kimenet:

Temperature in Fahrenheit: 212
Temperature in Celcius: 100
Temperature in Fahrenheit: 32
Temperature in Celcius: 0
Temperature in Fahrenheit: 149
Temperature in Celcius: 65
Temperature in Fahrenheit: 302
Temperature in Celcius: 150
Temperature in Fahrenheit: 68
Temperature in Celcius: 20

Python program a Fahrenheit hőmérséklet Celsius -fokra történő átalakítására

Az alábbiakban található a Python program a Fahrenheit -Celsius -konverzióhoz:

# Python program to convert temperature in Fahrenheit to Celcius
# Function to convert temperature in Fahrenheit to Celcius
def fahrenheitToCelcius(num):
return ((num - 32.0) * 5.0 / 9.0)
num1 = 212
print('Temperature in Fahrenheit:', num1)
print('Temperature in Celcius:', fahrenheitToCelcius(num1))
num2 = 32
print('Temperature in Fahrenheit:', num2)
print('Temperature in Celcius:', fahrenheitToCelcius(num2))
num3 = 149
print('Temperature in Fahrenheit:', num3)
print('Temperature in Celcius:', fahrenheitToCelcius(num3))
num4 = 302
print('Temperature in Fahrenheit:', num4)
print('Temperature in Celcius:', fahrenheitToCelcius(num4))
num5 = 68
print('Temperature in Fahrenheit:', num5)
print('Temperature in Celcius:', fahrenheitToCelcius(num5))

Kimenet:

Temperature in Fahrenheit: 212
Temperature in Celcius: 100.0
Temperature in Fahrenheit: 32
Temperature in Celcius: 0.0
Temperature in Fahrenheit: 149
Temperature in Celcius: 65.0
Temperature in Fahrenheit: 302
Temperature in Celcius: 150.0
Temperature in Fahrenheit: 68
Temperature in Celcius: 20.0

Kapcsolódó: Hogyan lehet megtalálni a két számból álló LCM -t és GCD -t több nyelven

JavaScript program a Fahrenheit -hőmérséklet Celsius -fokra történő konvertálására

Az alábbiakban a JavaScript program található Fahrenheit -Celsius -konverzióhoz:

hogyan kell telepíteni a nintendont wii u
// JavaScript program to convert temperature in Celcius to Fahrenheit
// Function to convert temperature in Celcius to Fahrenheit
function fahrenheitToCelcius(num) {
return ((num - 32.0) * 5.0 / 9.0);
}

var num1 = 212;
document.write('Temperature in Fahrenheit: ' + num1 + '
');
document.write('Temperature in Celcius: ' + fahrenheitToCelcius(num1) + '
');
var num2 = 32;
document.write('Temperature in Fahrenheit: ' + num2 + '
');
document.write('Temperature in Celcius: ' + fahrenheitToCelcius(num2) + '
');
var num3 = 149;
document.write('Temperature in Fahrenheit: ' + num3 + '
');
document.write('Temperature in Celcius: ' + fahrenheitToCelcius(num3) + '
');
var num4 = 302;
document.write('Temperature in Fahrenheit: ' + num4 + '
');
document.write('Temperature in Celcius: ' + fahrenheitToCelcius(num4) + '
');
var num5 = 68;
document.write('Temperature in Fahrenheit: ' + num5 + '
');
document.write('Temperature in Celcius: ' + fahrenheitToCelcius(num5) + '
');

Kimenet:

Temperature in Fahrenheit: 212
Temperature in Celcius: 100
Temperature in Fahrenheit: 32
Temperature in Celcius: 0
Temperature in Fahrenheit: 149
Temperature in Celcius: 65
Temperature in Fahrenheit: 302
Temperature in Celcius: 150
Temperature in Fahrenheit: 68
Temperature in Celcius: 20

A Celsius -fokra Fahrenheit -fé konvertálása nem kell, hogy nehéz legyen

Nos, itt van - most már tudja, hogyan kell a Celsiust Fahrenheitre konvertálni - és fordítva. A két fő hőmérsékleti típus ismerete fontos, különösen akkor, ha bármilyen munkát végez mind az Egyesült Államokban (vagy a Fahrenheit -értéket használó más helyek kis választékában), mind más országokban.

A programozás legjobb módja a projektek fejlesztése. A projektek fejlesztése segít abban, hogy jobb programozóvá váljon. Ha még nem ismeri a programozást, és kezdő szintű projekteket keres, próbáljon ki néhány projektet, például sakkjátékot, számológépet, digitális órát, egyszerű webhelyet, teendőlista-alkalmazást stb.

Részvény Részvény Csipog Email Digitális óra létrehozása HTML, CSS és JavaScript használatával

Addig kódol, amíg a csicsergő madarak nem tájékoztatják, hogy reggel van? Kövesse nyomon az időt ezzel az egyedi órával.

Olvassa tovább
Kapcsolódó témák
  • Programozás
  • JavaScript
  • Piton
  • Kódolási oktatóanyagok
A szerzőről Yuvraj Chandra(60 cikk megjelent)

Yuvraj egy számítástechnikai egyetemi hallgató a Delhi Egyetemen, Indiában. Szenvedélyesen foglalkozik a Full Stack webfejlesztéssel. Amikor nem ír, a különböző technológiák mélységét kutatja.

Bővebben: Yuvraj Chandra

Iratkozzon fel hírlevelünkre

Csatlakozz hírlevelünkhöz, ahol technikai tippeket, értékeléseket, ingyenes e -könyveket és exkluzív ajánlatokat találsz!

Feliratkozáshoz kattintson ide