{"id":735,"date":"2026-10-04T09:00:00","date_gmt":"2026-10-04T03:30:00","guid":{"rendered":"https:\/\/smitabharat.com\/blog\/go-hello-world-print-programs\/"},"modified":"2026-11-29T01:29:44","modified_gmt":"2026-11-28T19:59:44","slug":"go-hello-world-print-programs","status":"publish","type":"post","link":"https:\/\/smitabharat.com\/blog\/go-hello-world-print-programs\/","title":{"rendered":"Go Print Programs with Output: Hello World, Println, Printf"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Go print programs are the first real programs every learner writes, starting with the classic Hello World. In this post, you will write twelve small Go print programs that print text, numbers and tables, each with its exact output. After that, you will practice the print questions that interviewers love, because they test how well you know Go&#8217;s rules.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This post starts Level 2 of our Go programs series. Before you begin, make sure you know <a href=\"https:\/\/smitabharat.com\/blog\/how-to-run-a-go-program\/\">how to run a Go program<\/a> with <code>go run .<\/code>. You can also test every program here in an <a href=\"https:\/\/smitabharat.com\/blog\/online-go-compilers\/\">online Go compiler<\/a>, since none of them read input. We tested all programs on Go 1.27.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What are Go Print Programs?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A print program sends text to the screen. In Go, you use the <code>fmt<\/code> package for this. Its name is short for &#8220;format&#8221;, and it gives you functions like <code>Println<\/code>, <code>Print<\/code> and <code>Printf<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Think of <code>fmt<\/code> as a printer in an office. <code>Println<\/code> prints a page and moves to the next line. <code>Print<\/code> keeps writing on the same line. <code>Printf<\/code> lets you fill in a form, where you decide exactly where each value goes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why Practice Go Print Programs?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Printing looks simple, but it shows up in every program you will ever write. For example, you print results, debug values and error messages. Interviewers also ask &#8220;what does this print?&#8221; questions to test your attention to detail.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Debugging:<\/strong> printing a value with <code>%v<\/code> or <code>%T<\/code> is the quickest way to see what a variable holds.<\/li>\n\n\n<li><strong>Reports:<\/strong> with width and padding, you can print neat tables and receipts.<\/li>\n\n\n<li><strong>Interviews:<\/strong> many output questions depend on how <code>Println<\/code> adds spaces and new lines.<\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">How Go Print Programs Work<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Every print call follows the same path. Your program passes values to an <code>fmt<\/code> function. Then the function turns each value into text and writes it to standard output, which is usually your terminal.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><a href=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-hello-world-print-programs-diagram-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-hello-world-print-programs-diagram-1-1024x640.png\" alt=\"Go print programs diagram showing values passing through fmt functions to the terminal\" class=\"wp-image-714\" srcset=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-hello-world-print-programs-diagram-1-1024x640.png 1024w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-hello-world-print-programs-diagram-1-300x188.png 300w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-hello-world-print-programs-diagram-1-768x480.png 768w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-hello-world-print-programs-diagram-1-1536x960.png 1536w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-hello-world-print-programs-diagram-1-2048x1280.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Your values go into an fmt function, which formats them as text and writes them to standard output.<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The table below compares the three main print functions.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Function<\/th><th>Adds spaces between values<\/th><th>Adds new line at end<\/th><th>Uses format verbs<\/th><\/tr><\/thead><tbody><tr><td>fmt.Print<\/td><td>Only between two non-strings<\/td><td>No<\/td><td>No<\/td><\/tr><tr><td>fmt.Println<\/td><td>Always<\/td><td>Yes<\/td><td>No<\/td><\/tr><tr><td>fmt.Printf<\/td><td>No<\/td><td>No, add \\n yourself<\/td><td>Yes<\/td><\/tr><tr><td>fmt.Sprintf<\/td><td>No<\/td><td>No<\/td><td>Yes, returns a string<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><a href=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-hello-world-print-programs-diagram-2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-hello-world-print-programs-diagram-2-1024x640.png\" alt=\"Go print programs comparison of Print, Println and Printf\" class=\"wp-image-715\" srcset=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-hello-world-print-programs-diagram-2-1024x640.png 1024w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-hello-world-print-programs-diagram-2-300x188.png 300w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-hello-world-print-programs-diagram-2-768x480.png 768w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-hello-world-print-programs-diagram-2-1536x960.png 1536w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-hello-world-print-programs-diagram-2-2048x1280.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Print keeps text on one line, Println adds spaces and a new line, and Printf follows your format string.<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Basic Go Print Programs<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s start with the simplest Go print programs. Each one is complete, so you can copy it into <code>main.go<\/code> and run it.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Program 1: Hello World in Go<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This is the first program in almost every language. It prints one line and ends.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package main \/\/ package main makes this a runnable program\n\nimport \"fmt\" \/\/ fmt is the standard package for printing\n\n\/\/ main is where the program starts\nfunc main() {\n    fmt.Println(\"Hello, World!\") \/\/ print the text, then move to a new line\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Hello, World!<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>package main<\/code> makes this a runnable program, and <code>func main()<\/code> is where it starts. <code>fmt.Println<\/code> prints the text and adds a new line at the end.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Program 2: Print Many Values with Println<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>Println<\/code> can take any number of values of any type. It puts one space between them.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package main\n\nimport \"fmt\"\n\n\/\/ main prints a name, an age and a height in one line\nfunc main() {\n    \/\/ := creates a new variable and Go picks its type from the value\n    name := \"Asha\"  \/\/ a string (text)\n    age := 25       \/\/ an int (whole number)\n    height := 5.4   \/\/ a float64 (decimal number)\n\n    fmt.Println(\"Name:\", name, \"Age:\", age, \"Height:\", height)\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Name: Asha Age: 25 Height: 5.4<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Here, Go printed a string, an int and a float64 in one call. So you do not need to convert numbers to text first.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Program 3: Print vs Println on the Same Line<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>Print<\/code> does not add a new line. So the next print continues on the same line.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package main\n\nimport \"fmt\"\n\n\/\/ main builds one line with three Print calls, then prints a second line\nfunc main() {\n    fmt.Print(\"Go \")  \/\/ no new line after this\n    fmt.Print(\"is \")\n    fmt.Print(\"fun\")\n    fmt.Println() \/\/ an empty Println just ends the line\n\n    fmt.Println(\"Next\", \"line\")\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Go is fun\nNext line<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The empty <code>fmt.Println()<\/code> call just prints a new line. We added the spaces ourselves inside the strings, because <code>Print<\/code> only adds spaces between two values when neither one is a string.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Program 4: Simple Maths in Go Print Programs<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Go print programs can show the answer to a sum right away. Go works out the maths first, and then it prints the result.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package main\n\nimport \"fmt\"\n\n\/\/ main prints the results of four simple sums\nfunc main() {\n    apples := 12\n    oranges := 8\n\n    fmt.Println(\"Apples + oranges =\", apples+oranges)\n    fmt.Println(\"Apples - oranges =\", apples-oranges)\n    fmt.Println(\"Apples x oranges =\", apples*oranges)\n    fmt.Println(\"Apples \/ 4 =\", apples\/4) \/\/ \/ divides whole numbers\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Apples + oranges = 20\nApples - oranges = 4\nApples x oranges = 96\nApples \/ 4 = 3<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">First, the program stores two numbers in variables. Then each <code>Println<\/code> line does one sum and prints the text with the answer. The text inside quotes is printed as it is, so &#8220;x&#8221; is just a letter there.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Formatted Go Print Programs with Printf<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Formatted Go print programs use <code>Printf<\/code> with format verbs. A verb is a placeholder that starts with <code>%<\/code>, such as <code>%d<\/code> for a whole number. Go swaps each verb for the matching value in order.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Program 5: Your First Printf Line<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s start with just two verbs. <code>%s<\/code> stands for a string, and <code>%d<\/code> stands for a whole number.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package main\n\nimport \"fmt\"\n\n\/\/ main fills a sentence with a name and an age\nfunc main() {\n    name := \"Ravi\"\n    age := 30\n\n    \/\/ %s is replaced by name, %d by age, and \\n starts a new line\n    fmt.Printf(\"%s is %d years old.\\n\", name, age)\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Ravi is 30 years old.<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Go reads the format string from left to right. It puts <code>name<\/code> where <code>%s<\/code> is and <code>age<\/code> where <code>%d<\/code> is. The <code>\\n<\/code> at the end moves the cursor to the next line.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Program 6: Common Format Verbs<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This program prints the same kinds of values with the most useful verbs.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package main\n\nimport \"fmt\"\n\n\/\/ main shows the most useful Printf verbs, one per line\nfunc main() {\n    city := \"Pune\"\n    marks := 87\n    price := 249.5\n    passed := true\n\n    fmt.Printf(\"City: %s\\n\", city)            \/\/ %s: plain text\n    fmt.Printf(\"Quoted: %q\\n\", city)          \/\/ %q: text inside quotes\n    fmt.Printf(\"Marks: %d\\n\", marks)          \/\/ %d: whole number\n    fmt.Printf(\"Price: %.2f\\n\", price)        \/\/ %.2f: decimal with 2 places\n    fmt.Printf(\"Passed: %t\\n\", passed)        \/\/ %t: true or false\n    fmt.Printf(\"Type of price: %T\\n\", price)  \/\/ %T: the type name\n    fmt.Printf(\"Any value: %v\\n\", marks)      \/\/ %v: any value, default form\n    fmt.Printf(\"Discount: 10%%\\n\")            \/\/ %%: a real percent sign\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>City: Pune\nQuoted: \"Pune\"\nMarks: 87\nPrice: 249.50\nPassed: true\nType of price: float64\nAny value: 87\nDiscount: 10%<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Notice the <code>\\n<\/code> at the end of each format string. <code>Printf<\/code> never adds a new line by itself. Also, <code>%%<\/code> prints a real percent sign.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here is a quick reference of the verbs you will use most.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Verb<\/th><th>Prints<\/th><th>Example output<\/th><\/tr><\/thead><tbody><tr><td>%v<\/td><td>Any value in default format<\/td><td>87<\/td><\/tr><tr><td>%+v<\/td><td>Struct with field names<\/td><td>{Name:Ravi Age:30}<\/td><\/tr><tr><td>%#v<\/td><td>Go syntax form<\/td><td>main.User{Name:&#8221;Ravi&#8221;}<\/td><\/tr><tr><td>%T<\/td><td>The type<\/td><td>float64<\/td><\/tr><tr><td>%d<\/td><td>Whole number<\/td><td>87<\/td><\/tr><tr><td>%s<\/td><td>String<\/td><td>Pune<\/td><\/tr><tr><td>%q<\/td><td>Quoted string<\/td><td>&#8220;Pune&#8221;<\/td><\/tr><tr><td>%f \/ %.2f<\/td><td>Decimal number<\/td><td>249.50<\/td><\/tr><tr><td>%t<\/td><td>Boolean<\/td><td>true<\/td><\/tr><tr><td>%x<\/td><td>Hexadecimal<\/td><td>ff<\/td><\/tr><tr><td>%c<\/td><td>Character from a rune<\/td><td>A<\/td><\/tr><tr><td>%%<\/td><td>A percent sign<\/td><td>%<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Program 7: Print a Struct Three Ways<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Structs hold related fields together. The <code>%v<\/code>, <code>%+v<\/code> and <code>%#v<\/code> verbs show them with more detail each time.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package main\n\nimport \"fmt\"\n\n\/\/ User holds a person's name and age together\ntype User struct {\n    Name string\n    Age  int\n}\n\n\/\/ main prints one User with three different verbs\nfunc main() {\n    user := User{Name: \"Ravi\", Age: 30} \/\/ make a User value\n\n    fmt.Printf(\"%v\\n\", user)  \/\/ values only\n    fmt.Printf(\"%+v\\n\", user) \/\/ field names and values\n    fmt.Printf(\"%#v\\n\", user) \/\/ the value written as Go code\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>{Ravi 30}\n{Name:Ravi Age:30}\nmain.User{Name:\"Ravi\", Age:30}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Use <code>%+v<\/code> while debugging, because it shows which value belongs to which field. We cover structs fully later in this series.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Program 8: Width and Padding<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">You can set a width between <code>%<\/code> and the verb. A minus sign aligns text to the left, and a zero pads numbers with zeros.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package main\n\nimport \"fmt\"\n\n\/\/ main prints values inside [ ] so you can see the padding spaces\nfunc main() {\n    fmt.Printf(\"[%5d]\\n\", 42)       \/\/ width 5, number on the right\n    fmt.Printf(\"[%-5d]\\n\", 42)      \/\/ width 5, number on the left\n    fmt.Printf(\"[%05d]\\n\", 42)      \/\/ width 5, filled with zeros\n    fmt.Printf(\"[%8.2f]\\n\", 3.14159) \/\/ width 8, 2 decimal places\n    fmt.Printf(\"[%-8s]\\n\", \"Go\")    \/\/ width 8, text on the left\n    fmt.Printf(\"[%8s]\\n\", \"Go\")     \/\/ width 8, text on the right\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>[   42]\n[42   ]\n[00042]\n[    3.14]\n[Go      ]\n[      Go]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The square brackets show where the spaces go. For example, <code>%05d<\/code> turns 42 into 00042, which is handy for order numbers.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Real-World Go Print Programs<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Now let&#8217;s use these tools in Go print programs that do something useful.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Program 9: Print a Shop Receipt Table<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This program prints a neat receipt with aligned columns. It uses a slice of structs and a loop, which we explain fully in later posts.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package main\n\nimport \"fmt\"\n\n\/\/ Item is one line on the receipt\ntype Item struct {\n    Name     string\n    Quantity int\n    Price    float64\n}\n\n\/\/ main prints a receipt with aligned columns and a total\nfunc main() {\n    \/\/ a slice is a list; this one holds three Item values\n    items := []Item{\n        {\"Notebook\", 2, 45.00},\n        {\"Pen\", 5, 10.50},\n        {\"Bag\", 1, 799.99},\n    }\n\n    \/\/ Step 1: print the header row\n    fmt.Printf(\"%-10s %4s %9s\\n\", \"Item\", \"Qty\", \"Amount\")\n\n    \/\/ Step 2: print each item and add its amount to the total\n    total := 0.0\n    for _, item := range items { \/\/ range gives each item in turn; _ skips the position\n        amount := float64(item.Quantity) * item.Price \/\/ turn the int into a float64 before multiplying\n        total += amount\n        fmt.Printf(\"%-10s %4d %9.2f\\n\", item.Name, item.Quantity, amount)\n    }\n\n    \/\/ Step 3: print the total row\n    fmt.Printf(\"%-10s %4s %9.2f\\n\", \"Total\", \"\", total)\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Item        Qty    Amount\nNotebook      2     90.00\nPen           5     52.50\nBag           1    799.99\nTotal              942.49<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>%-10s<\/code> keeps names on the left in a 10-character column, while <code>%9.2f<\/code> lines up the amounts on the right. As a result, the decimal points sit in one straight line.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Program 10: Build a String with Sprintf<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>Sprintf<\/code> works like <code>Printf<\/code>, but it returns the text instead of printing it. This is useful for messages, file names and logs.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package main\n\nimport \"fmt\"\n\n\/\/ main builds a message with Sprintf, then prints it and its length\nfunc main() {\n    orderID := 7\n    customer := \"Meera\"\n\n    \/\/ %03d prints the number with at least 3 digits, adding zeros in front\n    message := fmt.Sprintf(\"Order #%03d is ready for %s\", orderID, customer)\n\n    fmt.Println(message)\n    fmt.Println(\"Length:\", len(message)) \/\/ len counts the characters (bytes)\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Order #007 is ready for Meera\nLength: 29<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Because <code>message<\/code> is a normal string, you can store it, send it or print it later.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Program 11: Escape Sequences and Raw Strings<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Escape sequences are special pairs that start with a backslash. A raw string uses backticks, so Go prints it exactly as written.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package main\n\nimport \"fmt\"\n\n\/\/ main prints special characters, then a raw string\nfunc main() {\n    fmt.Println(\"Name:\\tAsha\")         \/\/ \\t is a tab\n    fmt.Println(\"She said \\\"Hi\\\"\")     \/\/ \\\" prints a double quote\n    fmt.Println(\"Path: C:\\\\Go\\\\bin\")   \/\/ \\\\ prints one backslash\n    fmt.Println(`Raw: C:\\Go\\bin\\n stays as typed`) \/\/ backticks: nothing is special\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Name:\tAsha\nShe said \"Hi\"\nPath: C:\\Go\\bin\nRaw: C:\\Go\\bin\\n stays as typed<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>\\t<\/code> adds a tab, <code>\\\"<\/code> prints a quote and <code>\\\\<\/code> prints one backslash. Inside backticks, none of these are special.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Program 12: Print Unicode and Characters<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Go strings are UTF-8, so you can print text in Hindi, Marathi or any other language. A rune is one Unicode character.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package main\n\nimport \"fmt\"\n\n\/\/ main prints a rune three ways, then some Hindi text\nfunc main() {\n    letter := 'A' \/\/ single quotes make a rune, which is a character code\n\n    fmt.Println(letter)                              \/\/ prints the number 65\n    fmt.Printf(\"%c %d %U\\n\", letter, letter, letter) \/\/ %c letter, %d number, %U Unicode code\n    fmt.Println(\"\u0928\u092e\u0938\u094d\u0924\u0947\", \"Go\")\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>65\nA 65 U+0041\n\u0928\u092e\u0938\u094d\u0924\u0947 Go<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>Println<\/code> prints a rune as its number, 65. To see the letter, use <code>%c<\/code>. This surprises many beginners, so it is a common interview question.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Common Mistakes in Go Print Programs<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">These are the errors we see most often in beginner code.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Forgetting \\n in Printf:<\/strong> all output lands on one line. Add <code>\\n<\/code> at the end of the format string.<\/li>\n\n\n<li><strong>Wrong verb for the type:<\/strong> <code>%d<\/code> with a string prints <code>%!d(string=...)<\/code>. Run <code>go vet<\/code> to catch it early.<\/li>\n\n\n<li><strong>Too few values:<\/strong> a missing value prints <code>%!d(MISSING)<\/code>, so count your verbs.<\/li>\n\n\n<li><strong>Printing a rune with Println:<\/strong> you get a number. Use <code>%c<\/code> or <code>string(r)<\/code> for the character.<\/li>\n\n\n<li><strong>Unused import:<\/strong> importing <code>fmt<\/code> and not using it is a compile error in Go.<\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Best Practices for Go Print Programs<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Follow these habits to keep your Go print programs clean and easy to read.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Use Println for quick output<\/strong> and <code>Printf<\/code> when you need control over layout.<\/li>\n\n\n<li><strong>Pick %+v for debugging structs<\/strong>, so field names are visible.<\/li>\n\n\n<li><strong>Use Sprintf to build strings<\/strong> instead of joining many pieces with <code>+<\/code>.<\/li>\n\n\n<li><strong>Send errors to standard error<\/strong> with <code>fmt.Fprintln(os.Stderr, ...)<\/code>, so they do not mix with normal output.<\/li>\n\n\n<li><strong>Run go vet<\/strong>, because it checks every Printf call for wrong verbs.<\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Go Print Programs Interview Questions and Answers<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Interviewers often use Go print programs to test your knowledge of output rules. Each program is complete, and we show the real output from Go 1.27.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Println Questions in Go Print Programs<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q1. What is the difference between Print, Println and Printf?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>Print<\/code> writes values with no new line. <code>Println<\/code> adds spaces between values and a new line at the end. <code>Printf<\/code> follows a format string with verbs and adds nothing extra.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q2. What does this program print?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package main\n\nimport \"fmt\"\n\n\/\/ main mixes strings and numbers in one Print call\nfunc main() {\n    fmt.Print(\"a\", \"b\", 1, 2, \"c\")\n    fmt.Println() \/\/ end the line\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>ab1 2c<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>Print<\/code> adds a space only between two values when neither is a string. So &#8220;a&#8221; and &#8220;b&#8221; join, 1 and 2 get a space, and &#8220;c&#8221; joins the 2.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q3. What does this program print?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package main\n\nimport \"fmt\"\n\n\/\/ main prints the same values with Println\nfunc main() {\n    fmt.Println(\"a\", \"b\", 1, 2, \"c\")\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>a b 1 2 c<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>Println<\/code> always adds a space between every value. That is the key difference from <code>Print<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q4. What is the difference between println and fmt.Println?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>println<\/code> is a built-in function meant for debugging the Go runtime. It writes to standard error, and its format may change. In real code, always use <code>fmt.Println<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q5. What does fmt.Println return?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It returns two values: the number of bytes written and an error. Most code ignores them, but you can check them.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package main\n\nimport \"fmt\"\n\n\/\/ main prints \"Hello\" and then the two values Println returned\nfunc main() {\n    \/\/ bytesWritten is how many bytes were printed\n    \/\/ err is the error value; nil means no error\n    bytesWritten, err := fmt.Println(\"Hello\")\n    fmt.Println(bytesWritten, err)\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Hello\n6 &lt;nil&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">&#8220;Hello&#8221; is 5 bytes, and the new line adds 1 more, so <code>bytesWritten<\/code> is 6. The error is <code>nil<\/code> because the write worked.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Printf and Format Verb Questions<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q6. What does this program print?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package main\n\nimport \"fmt\"\n\n\/\/ main makes two common Printf mistakes on purpose\nfunc main() {\n    fmt.Printf(\"%d\\n\", \"ten\")  \/\/ wrong type: %d needs a number\n    fmt.Printf(\"%d %d\\n\", 5)   \/\/ missing value: two verbs, one value\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>%!d(string=ten)\n5 %!d(MISSING)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Go does not crash on a bad verb. Instead, it prints a clear marker that shows the problem. <code>go vet<\/code> reports both lines before you even run the code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q7. How do you print the type of a variable?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Use the <code>%T<\/code> verb. For example, <code>fmt.Printf(\"%T\", 3.5)<\/code> prints <code>float64<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q8. What does this program print?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package main\n\nimport \"fmt\"\n\n\/\/ main shares 10 sweets among 3 children, first as whole numbers, then as decimals\nfunc main() {\n    sweets := 10\n    children := 3\n\n    \/\/ int \/ int gives an int, so the decimal part is dropped\n    fmt.Println(sweets \/ children)\n\n    \/\/ float64(...) turns each int into a decimal number before dividing\n    fmt.Printf(\"%.2f\\n\", float64(sweets)\/float64(children))\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>3\n3.33<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Dividing two ints gives an int, so the decimal part is dropped. To get 3.33, convert to <code>float64<\/code> first and use <code>%.2f<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q9. How do you print a percent sign with Printf?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Write <code>%%<\/code>. A single <code>%<\/code> starts a verb, so Go needs two to print one.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q10. What does this program print?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package main\n\nimport \"fmt\"\n\n\/\/ main builds a string with Sprint, then prints it and its length\nfunc main() {\n    text := fmt.Sprint(\"Go\", 1, 2, \"!\") \/\/ Sprint returns the text instead of printing it\n    fmt.Println(text)\n    fmt.Println(len(text))\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Go1 2!\n6<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>Sprint<\/code> follows the same spacing rule as <code>Print<\/code>, but returns a string. The result &#8220;Go1 2!&#8221; has 6 characters.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q11. What is the difference between %v, %+v and %#v?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>%v<\/code> prints the default form. <code>%+v<\/code> adds field names for structs. <code>%#v<\/code> prints the value as Go code, including the type name.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Runes, Strings and Special Values<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q12. What does this program print?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package main\n\nimport \"fmt\"\n\n\/\/ main prints a rune as a number and then as a letter\nfunc main() {\n    letter := 'G'\n    fmt.Println(letter)         \/\/ the character code\n    fmt.Println(string(letter)) \/\/ string(...) turns the code into text\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>71\nG<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">A rune is an alias for <code>int32<\/code>, so <code>Println<\/code> shows its number. Converting with <code>string(letter)<\/code> gives the letter.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q13. What does this program print?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package main\n\nimport \"fmt\"\n\n\/\/ main prints three variables that were never given a value\nfunc main() {\n    var pointer *int         \/\/ *int is a pointer to an int; its zero value is nil\n    var numbers []int        \/\/ a slice of ints with nothing in it\n    var ages map[string]int  \/\/ a map from names to ages, also empty\n    fmt.Println(pointer, numbers, ages)\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;nil&gt; [] map[]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">All three are zero values. A nil pointer prints <code>&lt;nil&gt;<\/code>, while a nil slice and a nil map print as empty.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q14. What does this program print?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package main\n\nimport \"fmt\"\n\n\/\/ main compares the byte length of English and Hindi text\nfunc main() {\n    \/\/ len counts bytes, not letters\n    fmt.Println(len(\"Go\"), len(\"\u0939\u093f\u0902\"))\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>2 9<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>len<\/code> counts bytes, not characters. Each Hindi character here takes 3 bytes in UTF-8, so the result is 9.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q15. What does this program print?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package main\n\nimport \"fmt\"\n\n\/\/ main prints numbers in base 16, base 8 and base 2\nfunc main() {\n    \/\/ %x small hex, %X capital hex, %o octal, %b binary\n    fmt.Printf(\"%x %X %o %b\\n\", 255, 255, 8, 5)\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>ff FF 10 101<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>%x<\/code> and <code>%X<\/code> print hexadecimal in lower and upper case. <code>%o<\/code> prints octal, and <code>%b<\/code> prints binary.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q16. What does this program print?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package main\n\nimport \"fmt\"\n\n\/\/ main prints three decimals with different widths and padding\nfunc main() {\n    \/\/ %6.2f: width 6, 2 places | %-6.1f: left aligned | %06.2f: zero padded\n    fmt.Printf(\"%6.2f|%-6.1f|%06.2f\\n\", 3.14159, 2.5, 3.14159)\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>  3.14|2.5   |003.14<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The number before the dot is the full width, and the number after it is the decimal places. A minus sign aligns left, and a zero pads with zeros.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Output Destination Questions<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q17. How do you print an error message to standard error?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Use <code>fmt.Fprintln(os.Stderr, \"message\")<\/code>. The first argument is any <code>io.Writer<\/code>, so the same function can also write to files or network connections.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q18. Can you print without the fmt package?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Yes. You can use <code>os.Stdout.WriteString(\"hi\\n\")<\/code>, the <code>log<\/code> package, or the built-in <code>println<\/code>. However, <code>fmt<\/code> is the normal choice for program output.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q19. What does this program print?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package main\n\nimport \"fmt\"\n\n\/\/ main shows that + adds numbers but joins strings\nfunc main() {\n    first := 5\n    second := 7\n    fmt.Println(\"Sum:\", first+second, \"Product:\", first*second)\n    fmt.Println(\"Text: \" + \"5\" + \"7\") \/\/ \"5\" and \"7\" are strings, so + joins them\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Sum: 12 Product: 35\nText: 57<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">With numbers, <code>+<\/code> adds them. With strings, <code>+<\/code> joins them. So &#8220;5&#8221; + &#8220;7&#8221; gives &#8220;57&#8221;, not 12.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q20. What does this program print?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package main\n\nimport \"fmt\"\n\n\/\/ main prints a bool and the same slice with two verbs\nfunc main() {\n    letters := []string{\"a\", \"b\"} \/\/ a slice of two strings\n    fmt.Printf(\"%t %v %q\\n\", 1 &gt; 2, letters, letters)\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>false [a b] [\"a\" \"b\"]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>%t<\/code> prints a boolean, and <code>%v<\/code> prints a slice inside square brackets. <code>%q<\/code> puts quotes around each string in the slice.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Practice Task<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This task combines all the Go print programs above. Write a program that prints a marks card for three subjects, with the subject name on the left, marks on the right, and the average with one decimal place. Hint: use <code>%-12s<\/code> for names and <code>%6.1f<\/code> for the average.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Official Resources<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/pkg.go.dev\/fmt\">fmt package documentation<\/a><\/li>\n\n\n<li><a href=\"https:\/\/go.dev\/tour\/welcome\/1\">A Tour of Go: Hello World<\/a><\/li>\n\n\n<li><a href=\"https:\/\/go.dev\/ref\/spec#String_literals\">Go spec: string literals<\/a><\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Quick Recap<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Go print programs use the <code>fmt<\/code> package: <code>Print<\/code>, <code>Println<\/code>, <code>Printf<\/code> and <code>Sprintf<\/code>.<\/li>\n\n\n<li><code>Println<\/code> adds spaces and a new line, but <code>Printf<\/code> adds nothing unless you write <code>\\n<\/code>.<\/li>\n\n\n<li>Format verbs like <code>%d<\/code>, <code>%s<\/code>, <code>%.2f<\/code>, <code>%T<\/code> and <code>%+v<\/code> control how values look.<\/li>\n\n\n<li>Width and padding, such as <code>%-10s<\/code> and <code>%05d<\/code>, help you print neat tables.<\/li>\n\n\n<li>A rune prints as a number with <code>Println<\/code>, so use <code>%c<\/code> to see the character.<\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">What&#8217;s Next?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Next, your programs start talking to the user. Read <a href=\"https:\/\/smitabharat.com\/blog\/go-user-input-programs\/\">Go user input programs with fmt.Scan and bufio<\/a>. To revise the basics of values first, see <a href=\"https:\/\/smitabharat.com\/blog\/go-variables-constants-data-types\/\">Go variables, constants and data types<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Go print programs are the first real programs every learner writes, starting with the classic Hello World. In this post, you will write twelve&hellip;<\/p>\n","protected":false},"author":1,"featured_media":716,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_swapz_level":"","_swapz_series_part":0,"_swapz_hide_toc":false,"_swapz_hide_featured":false,"_swapz_description":"","footnotes":""},"categories":[106],"tags":[96,95,11,107,104],"swapz_series":[],"class_list":["post-735","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-go-programs","tag-beginner","tag-go-interview-questions","tag-go-lang","tag-go-printf","tag-go-programs"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Go Print Programs: Hello World, Println, Printf<\/title>\n<meta name=\"description\" content=\"Go print programs with output: Hello World, Println, Printf, format verbs, padding and Sprintf, plus print interview questions with answers.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/smitabharat.com\/blog\/go-hello-world-print-programs\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Go Print Programs: Hello World, Println, Printf\" \/>\n<meta property=\"og:description\" content=\"Go print programs with output: Hello World, Println, Printf, format verbs, padding and Sprintf, plus print interview questions with answers.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/smitabharat.com\/blog\/go-hello-world-print-programs\/\" \/>\n<meta property=\"og:site_name\" content=\"Smita Bharat - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-04T03:30:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-11-28T19:59:44+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-hello-world-print-programs-featured.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2400\" \/>\n\t<meta property=\"og:image:height\" content=\"1260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Smita\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Smita\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"17 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-hello-world-print-programs\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-hello-world-print-programs\\\/\"},\"author\":{\"name\":\"Smita\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/27a1b1067d396703215c54acedbfd339\"},\"headline\":\"Go Print Programs with Output: Hello World, Println, Printf\",\"datePublished\":\"2026-10-04T03:30:00+00:00\",\"dateModified\":\"2026-11-28T19:59:44+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-hello-world-print-programs\\\/\"},\"wordCount\":2024,\"publisher\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/27a1b1067d396703215c54acedbfd339\"},\"image\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-hello-world-print-programs\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/go-hello-world-print-programs-featured.png\",\"keywords\":[\"Beginner\",\"Go Interview Questions\",\"Go Lang\",\"Go Printf\",\"Go Programs\"],\"articleSection\":[\"Go Programs\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-hello-world-print-programs\\\/\",\"url\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-hello-world-print-programs\\\/\",\"name\":\"Go Print Programs: Hello World, Println, Printf\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-hello-world-print-programs\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-hello-world-print-programs\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/go-hello-world-print-programs-featured.png\",\"datePublished\":\"2026-10-04T03:30:00+00:00\",\"dateModified\":\"2026-11-28T19:59:44+00:00\",\"description\":\"Go print programs with output: Hello World, Println, Printf, format verbs, padding and Sprintf, plus print interview questions with answers.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-hello-world-print-programs\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-hello-world-print-programs\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-hello-world-print-programs\\\/#primaryimage\",\"url\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/go-hello-world-print-programs-featured.png\",\"contentUrl\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/go-hello-world-print-programs-featured.png\",\"width\":2400,\"height\":1260,\"caption\":\"Go Print Programs featured image: terminal showing Hello World and Printf output\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-hello-world-print-programs\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Go Print Programs with Output: Hello World, Println, Printf\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/\",\"name\":\"Smita Bharat Blog\",\"description\":\"Golang &amp; Backend Development Tutorials and Interview Questions\",\"publisher\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/27a1b1067d396703215c54acedbfd339\"},\"alternateName\":\"Smita Bharat\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/27a1b1067d396703215c54acedbfd339\",\"name\":\"Smita\",\"logo\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/smitabharat.com\\\/blog\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Go Print Programs: Hello World, Println, Printf","description":"Go print programs with output: Hello World, Println, Printf, format verbs, padding and Sprintf, plus print interview questions with answers.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/smitabharat.com\/blog\/go-hello-world-print-programs\/","og_locale":"en_US","og_type":"article","og_title":"Go Print Programs: Hello World, Println, Printf","og_description":"Go print programs with output: Hello World, Println, Printf, format verbs, padding and Sprintf, plus print interview questions with answers.","og_url":"https:\/\/smitabharat.com\/blog\/go-hello-world-print-programs\/","og_site_name":"Smita Bharat - Blog","article_published_time":"2026-10-04T03:30:00+00:00","article_modified_time":"2026-11-28T19:59:44+00:00","og_image":[{"width":2400,"height":1260,"url":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-hello-world-print-programs-featured.png","type":"image\/png"}],"author":"Smita","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Smita","Est. reading time":"17 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/smitabharat.com\/blog\/go-hello-world-print-programs\/#article","isPartOf":{"@id":"https:\/\/smitabharat.com\/blog\/go-hello-world-print-programs\/"},"author":{"name":"Smita","@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/27a1b1067d396703215c54acedbfd339"},"headline":"Go Print Programs with Output: Hello World, Println, Printf","datePublished":"2026-10-04T03:30:00+00:00","dateModified":"2026-11-28T19:59:44+00:00","mainEntityOfPage":{"@id":"https:\/\/smitabharat.com\/blog\/go-hello-world-print-programs\/"},"wordCount":2024,"publisher":{"@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/27a1b1067d396703215c54acedbfd339"},"image":{"@id":"https:\/\/smitabharat.com\/blog\/go-hello-world-print-programs\/#primaryimage"},"thumbnailUrl":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-hello-world-print-programs-featured.png","keywords":["Beginner","Go Interview Questions","Go Lang","Go Printf","Go Programs"],"articleSection":["Go Programs"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/smitabharat.com\/blog\/go-hello-world-print-programs\/","url":"https:\/\/smitabharat.com\/blog\/go-hello-world-print-programs\/","name":"Go Print Programs: Hello World, Println, Printf","isPartOf":{"@id":"https:\/\/smitabharat.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/smitabharat.com\/blog\/go-hello-world-print-programs\/#primaryimage"},"image":{"@id":"https:\/\/smitabharat.com\/blog\/go-hello-world-print-programs\/#primaryimage"},"thumbnailUrl":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-hello-world-print-programs-featured.png","datePublished":"2026-10-04T03:30:00+00:00","dateModified":"2026-11-28T19:59:44+00:00","description":"Go print programs with output: Hello World, Println, Printf, format verbs, padding and Sprintf, plus print interview questions with answers.","breadcrumb":{"@id":"https:\/\/smitabharat.com\/blog\/go-hello-world-print-programs\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/smitabharat.com\/blog\/go-hello-world-print-programs\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/smitabharat.com\/blog\/go-hello-world-print-programs\/#primaryimage","url":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-hello-world-print-programs-featured.png","contentUrl":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-hello-world-print-programs-featured.png","width":2400,"height":1260,"caption":"Go Print Programs featured image: terminal showing Hello World and Printf output"},{"@type":"BreadcrumbList","@id":"https:\/\/smitabharat.com\/blog\/go-hello-world-print-programs\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/smitabharat.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Go Print Programs with Output: Hello World, Println, Printf"}]},{"@type":"WebSite","@id":"https:\/\/smitabharat.com\/blog\/#website","url":"https:\/\/smitabharat.com\/blog\/","name":"Smita Bharat Blog","description":"Golang &amp; Backend Development Tutorials and Interview Questions","publisher":{"@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/27a1b1067d396703215c54acedbfd339"},"alternateName":"Smita Bharat","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/smitabharat.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/27a1b1067d396703215c54acedbfd339","name":"Smita","logo":{"@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/smitabharat.com\/blog"]}]}},"_links":{"self":[{"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/posts\/735","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/comments?post=735"}],"version-history":[{"count":2,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/posts\/735\/revisions"}],"predecessor-version":[{"id":869,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/posts\/735\/revisions\/869"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/media\/716"}],"wp:attachment":[{"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/media?parent=735"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/categories?post=735"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/tags?post=735"},{"taxonomy":"swapz_series","embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/swapz_series?post=735"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}