Periodika..

Tsakiris Yannis orb at studiofm1.cs.teiher.gr
Tue Dec 9 12:26:57 EET 1997



On Sun, 7 Dec 1997, Harris Kosmidhs wrote:

> Ps: kai mia polu asxeth erothsh alla me exei paidecei polu tora teleutaia
> (kai epeidh oloi ligo polu edo 3eretai ma8hmatika..)
> to n(n-1)(n-2)...(n-k) dinei ena poluonumo. Ti suntelestes exei (se
> sunarthsh me to k bebaia).

De kserw kanena typo pou na sou dinei tous syntelestes, alla afto to
programma tous briskei me ton klasiko tropo..(polaplasiasmos polionimwn).

/* Ypologismos twn syntelestwn toy polywnymou x(x-1)(x-2)...(x-k) */

main()
{
        int i,j,k;
        char st[128];
        int *syn,*tmp;

        do
        {
                printf("k = ");
                gets(st);
        }
        while (sscanf(st,"%d",&k) < 1);

        syn=(int *)malloc(sizeof(int)*(k+2));
        tmp=(int *)malloc(sizeof(int)*(k+2));
        syn[0]=0;
        syn[1]=1;

        for (i=1; i<=k; i++)
        {
                for (j=0; j<=i; j++) tmp[j]=syn[j];
                for (j=0; j<=i; j++) syn[j+1]=tmp[j];
                syn[0]=0;
                for (j=0; j<=i; j++) syn[j]+=(-i)*tmp[j];
        }

        for (i=0; i<=k+1; i++) printf("%d ",syn[k+1-i]);
        printf("\n");
        free(syn);
        free(tmp);
}


--
====================================================================
Gia na mathete pos na xrisimopoiite ton majordomo, stilte e-mail
sto "majordomo at argos.hol.gr" me 1 grammi sto keimeno: help
Ta archives tis listas einai sto http://www.argos.hol.gr/lists
Gia opoiodipote problima stilte  e-mail ston owner-linux-greek-users
====================================================================



More information about the Linux-greek-users mailing list