Jak przekonwertować stopnie Celsjusza na Fahrenheita

Jak przekonwertować stopnie Celsjusza na Fahrenheita

Konwersja stopni Celsjusza na Fahrenheita i Fahrenheita na Celsjusza jest prawdopodobnie najbardziej zagmatwaną konwersją. Ale możesz łatwo przekonwertować temperatury, jeśli dobrze zrozumiesz proces konwersji.





jak się dowiedzieć, czy ktoś szuka Cię w internecie

W tym artykule dowiesz się, jak przeliczyć temperaturę w stopniach Celsjusza na stopnie Fahrenheita i odwrotnie.





Jak przekonwertować temperaturę w stopniach Celsjusza na Fahrenheita?

Możesz przeliczyć temperaturę w stopniach Celsjusza na Fahrenheita, korzystając z następującego wzoru:





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

Należy pomnożyć temperaturę °C przez 9/5 i dodać do niej 32. Wynik będzie w °F.

Stwierdzenie problemu

Masz temperaturę na jednego w °C, musisz przeliczyć to na °F. Przykład 1 : Niech num = 100. Zatem temperatura w °F = (100 x 9/5) + 32 = 212 Zatem wyjście to 212. Przykład 2 : Niech num = 0. Zatem temperatura w °F = (0 x 9/5) + 32 = 32 Zatem wyjście wynosi 32.



Program C++ do konwersji temperatury w stopniach Celsjusza na Fahrenheita

Poniżej znajduje się program C++ do konwersji Celsjusza na Fahrenheita:

// 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;
}

Wyjście:





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

Program Pythona do konwersji temperatury w stopniach Celsjusza na Fahrenheita

Poniżej znajduje się program Pythona do konwersji Celsjusza na Fahrenheita:

# 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))

Wyjście:





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

Związane z: Jak ukończyć wyzwanie FizzBuzz w 5 językach programowania?

Program JavaScript do konwersji temperatury w stopniach Celsjusza na Fahrenheita

Poniżej znajduje się program JavaScript do konwersji stopni Celsjusza na Fahrenheita:

// 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) + '
');

Wyjście:

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

Jak przekonwertować temperaturę w stopniach Fahrenheita na stopnie Celsjusza

Możesz przeliczyć temperaturę w stopniach Fahrenheita na stopnie Celsjusza, korzystając z następującego wzoru:

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

Musisz odjąć 32 od temperatury ° F, a następnie pomnożyć przez 5/9. Wynik będzie w °C.

Stwierdzenie problemu

Masz temperaturę na jednego w °F, musisz przeliczyć to na °C. Przykład 1 : Niech num = 212. Zatem temperatura w °C = (212 - 32) x 5/9 = 100 Zatem wyjście wynosi 100. Przykład 2 : Niech num = 32. Zatem temperatura w °C = (32 - 32) x 5/9 = 0 Zatem wyjście wynosi 0.Związane z: Jak znaleźć wartość ASCII postaci?

Program C++ do konwersji temperatury w stopniach Fahrenheita na stopnie Celsjusza

Poniżej znajduje się program C++ do konwersji Fahrenheita na Celsjusza:

// 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;
}

Wyjście:

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

Program Pythona do konwersji temperatury w stopniach Fahrenheita na stopnie Celsjusza

Poniżej znajduje się program Pythona do konwersji Fahrenheita na Celsjusza:

# 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))

Wyjście:

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

Powiązane: Jak znaleźć LCM i NWD dwóch liczb w wielu językach?

Program JavaScript do konwersji temperatury w stopniach Fahrenheita na stopnie Celsjusza

Poniżej znajduje się program JavaScript do konwersji stopni Fahrenheita na Celsjusza:

kto dzwoni do mnie z tego numeru za darmo
// 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) + '
');

Wyjście:

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

Konwersja stopni Celsjusza do Fahrenheita nie musi być trudna

A więc masz to — teraz wiesz, jak przekonwertować stopnie Celsjusza na Fahrenheita — i odwrotnie. Znajomość dwóch głównych rodzajów temperatur jest ważna, zwłaszcza jeśli wykonujesz jakąkolwiek pracę zarówno w USA (lub w niewielkim wyborze innych miejsc, w których stosuje się stopnie Fahrenheita), jak iw innych krajach.

Najlepszym sposobem na naukę programowania jest tworzenie projektów. Rozwijanie projektów pomaga stać się lepszym programistą. Jeśli dopiero zaczynasz programować i szukasz projektów dla początkujących, możesz spróbować opracować niektóre projekty, takie jak gra w szachy, kalkulator, zegar cyfrowy, prosta strona internetowa, aplikacja z listą rzeczy do zrobienia i tak dalej.

Udział Udział Ćwierkać E-mail Jak stworzyć zegar cyfrowy za pomocą HTML, CSS i JavaScript

Czy kodujesz, dopóki świergotliwe ptaki nie poinformują cię, że jest rano? Śledź czas dzięki temu niestandardowemu zegarowi.

Czytaj dalej
Powiązane tematy
  • Programowanie
  • JavaScript
  • Pyton
  • Poradniki kodowania
O autorze Yuvraj Chandra(60 opublikowanych artykułów)

Yuvraj jest studentem informatyki na Uniwersytecie w Delhi w Indiach. Jest pasjonatem Full Stack Web Development. Kiedy nie pisze, bada głębię różnych technologii.

Więcej od Yuvraja Chandra

Zapisz się do naszego newslettera

Dołącz do naszego newslettera, aby otrzymywać porady techniczne, recenzje, bezpłatne e-booki i ekskluzywne oferty!

Kliknij tutaj, aby zasubskrybować