Kareem, Here is an example,
package main import "fmt" func main() { fmt.Println("Enter degrees Celsius (℃): ") var celsius float64 fmt.Scanf("%f", &celsius) var fahrenheit float64 fahrenheit = ((celsius * 9) / 5) + 32 fmt.Printf("%.2f℃ is %.2f℉\n", celsius, fahrenheit) } Output: Enter degrees Celsius (℃): 10 10.00℃ is 50.00℉ See package fmt: https://golang.org/pkg/fmt/ Peter On Monday, January 27, 2020 at 10:54:45 AM UTC-5, Kareem Shaikh wrote: > > Hi All, > > Good Afternoon. > > My name is Kareem. > > I recently started learning GO on my own. > > I am going through the book "INTRODUCTION TO GO" from RIELY. > > I wrote a program to convert Degrees to Fahrenheit. It is as follows: > > *package main* > *import "fmt"* > > *func main () {* > > * fmt.Println("Enter the degrees to convert into farenhiet: ")* > * var Degrees float64* > * fmt.Scanf("%f", &Degrees)* > * var farenhiet float64* > * farenhiet = ((Degrees*9)/5) + 32* > * fmt.Println("&Degrees Degrees to Farenhiet is = ", Degrees, farenhiet)* > > *}* > > > In th last statement "* fmt.Println("&Degrees Degrees to Farenhiet is = > ", Degrees, farenhiet)" *I wanted to print the value of the degrees and > then the result. > > I am struggling with this. > > > Can anyone please tell me what should I change in order to get the right > output? > > For example: > > I want to change 10 degrees to Fahrenheit. > I want to print "10 degrees to Fahrenheit is = 50" > > Please help me with the code to print the exact line that I want. > I understand I can write the same statement as above but what I want > exactly is that we never know what number(degrees) we input. > So please help me modify the code as per my requirement. > > PS: Please help me with any books to read after the above mentioned book. > > > Thank You. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/78651856-4d33-4080-8875-3a33430b31a0%40googlegroups.com.