U E D R , A S I H C RSS

이태균/LittleAOI/호너의법칙

No difference found



소 감



코 드

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)




}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2018-07-16 11:03:30
Processing time 0.1016 sec