package main import ( "fmt" "os" ) func main() { file1, _ := os.Create("output.txt") defer file1.Close() a := []int{3,3,3,3,3,3,3,3,3,3,3} var x int add:=0 mul:=0 fmt.Scan(&x) y := a[0] for i:=1;i<11;i++{ y = (y*x) + a[i] add++ mul++ } fmt.Fprintln(file1,"=====================================================") fmt.Fprint(file1,"|index|") for j:=0;j<11;j++ { fmt.Fprintf(file1," %d |",j) } fmt.Fprintln(file1,"\n=====================================================") fmt.Fprint(file1,"|index|") for k:=0;k<11;k++ { fmt.Fprintf(file1," %d |",a[k]) } fmt.Fprintln(file1,"\n=====================================================") fmt.Fprintf(file1,"#Horner Function Value ---> %d\n",y) fmt.Fprintf(file1,"#Horner ADD Value ---> %d\n",add) fmt.Fprintf(file1,"#Horner Multiply Value ---> %d\n",mul) }