
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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
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
Advertisements