grok-3-mini-high· xAI
LMArena Human Preference 140K
write a golang script that prints the first 10 numbers of pi
- User
write a golang script that prints the first 10 numbers of pi
- Assistant
Here's a complete Go script that prints the first 10 digits of Pi (including the leading
3and the first 9 decimal digits, resulting in3.141592653). I used a string representation of Pi to ensure accuracy, as using floating-point numbers can introduce rounding errors.package main import "fmt" func main() { // Define Pi as a string with sufficient decimal places for accuracy piString := "3.14159265358979323846" // Extract and print the first 10 digits (including the decimal point) // This slice gives characters from index 0 to 10, which is "3.141592653" fmt.Println(piString[:11]) }How to Run the Script
- Save the code to a file, e.g.,
pi.go. - Open a terminal and navigate to the directory containing the file.
- Save the code to a file, e.g.,
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.