U E D R , A S I H C RSS

호너의법칙/김정현

소 감

코 드

~cpp 
import java.util.Scanner;

public class Sum
{
	public static void main(String args[])
	{
		Scanner input = new Scanner(System.in);
		System.out.print("X값을 입력 ");
		int fX = input.nextInt();
		int a[]={3,3,3,3,3,3,3,3,3,3,3};
		int mul=0;
		int sum=0;
		int output=0;

		output = a[0];
		for(int i=0;i<a.length-1;i++)
		{
			output=output*fX+a[i+1];
			mul++;
			sum++;
		}

		//출력
		System.out.print("n========");
		for(int i=0;i<a.length;i++) System.out.print("====");
		System.out.print("n|index|");
		for(int i=0;i<a.length;i++)
			System.out.print(" "+i+" |");
		System.out.print("n========");
		for(int i=0;i<a.length;i++) System.out.print("====");
		System.out.print("n| data|");
		for(int i=0;i<a.length;i++)
			System.out.print(" "+a[i]+" |");
		System.out.print("n========");
		for(int i=0;i<a.length;i++)	System.out.print("====");
		System.out.println("nHorner Function Value ----> "+output);
		System.out.println("Horner ADD      Count ----> "+sum);
		System.out.println("Horner Multiply Count ----> "+mul);		
	}	
};

나한테 할말


으헉 이거 파일로 저장해야되는거? 김정현

LittleAOI 호너의법칙

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:31:33
Processing time 0.0158 sec