Golang Program to Take the Temperature in Celsius and Covert it to Farenheit
Steps
- Take the value of temperature in Celsius and store it in a variable.
- Convert it to Fahrenheit.
- Print the final result.
Enter the temperature in Celsius: 32 Temperature in Fahrenheit is: 89.6
| Enter the temperature in Celsius: 48 Temperature in Fahrenheit is: 118.4
|
Explanation
- User must first enter the value of temperature in Celsius.
- Using the formula: f=(c*1.8)+32, convert Celsius to Fahrenheit.
- Print the temperature in Fahrenheit.
Example
Live Demo
package main
import "fmt"
func main(){
var n int
fmt.Print("Enter the temperature in Celsius:")
fmt.Scanf("%d", &n)
f:=(float32(n)*1.8)+32
fmt.Println("Temperature in Fahrenheit is:", f)
}
Output
Enter the temperature in Celsius:32
Temperature in Fahrenheit is: 89.6
Related Articles
- Convert the temperature of 573 K to the Celsius scale.
- Convert temperature of 32°F to Celsius scale.
- How to Convert Temperature Units between Celsius, Kelvin and Fahrenheit in Excel?
- In countries like USA and Canada, temperature is measured in Fahrenheit, whereas in countries like India, it is measured in Celsius. Here is a linear equation that converts Fahrenheit to Celsius:\[\mathrm{F}=\left(\frac{9}{5}\right) \mathrm{C}+32\](i) Draw the graph of the linear equation above using Celsius for t-axis and Fahrenheit for \( y \)-axis.(ii) If the temperature is \( 30^{\circ} \mathrm{C} \), what is the temperature in Fahrenheit?(iii) If the temperature is \( 95^{\circ} \mathrm{F} \), what is the temperature in Celsius?(iv) If the temperature is \( 0^{\circ} \mathrm{C} \), what is the temperature in Fahrenheit and if the temperature is \( 0^{\circ} \mathrm{F} \), what is the temperature in Celsius?(v) Is there a temperature which is numerically the same in both Fahrenheit and Celsius? If yes, find it.
- The Kelvin temperature is 270 K. What is the corresponding Celsius scale temperature?
- Write the relation between Kelvin scale and Celsius scale of temperature.
- The temperature of a city is 4 degree Celsius. Next day the temperature falls by 5 degree Celsius. What is the temperature of the city next day?
- What is the formula to convert temperature in the Fahrenheit scale to the Centigrade or Celsius scale?
- The Kelvin scale temperature is 0 K. What is the corresponding Celsius scale temperature?
- Convert the following temperature to Celsius scale:(a) 300 K(b) 573 K
- How to convert Celsius to Fahrenheit and Fahrenheit to Celsius?
- What is the relationship between the Kelvin, Celsius and Fahrenheit scales of temperature?
- Golang program to take in a slice of integers and compute their sum using concurrency
- C# Program to Convert Fahrenheit to Celsius
- C++ program to convert Fahrenheit to Celsius
Kickstart Your Career
Get certified by completing the course
Get Started