Program Python untuk Mengubah Celsius Menjadi Fahrenheit

0
(0)

Dalam program di bawah ini, kami mengambil suhu dalam derajat Celcius dan mengubahnya menjadi derajat Fahrenheit. Mereka terkait dengan rumus:

celsius * 1.8 = fahrenheit - 32

Kode sumber

# Python Program to convert temperature in celsius to fahrenheit

# change this value for a different result
celsius = 37.5

# calculate fahrenheit
fahrenheit = (celsius * 1.8) + 32
print('%0.1f degree Celsius is equal to %0.1f degree Fahrenheit' %(celsius,fahrenheit))

Keluaran

37.5 degree Celsius is equal to 99.5 degree Fahrenheit

Kami mendorong Anda untuk membuat program Python untuk mengonversi Fahrenheit ke Celsius sendiri menggunakan rumus berikut

celsius = (fahrenheit - 32) / 1.8

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.