Share
Polinom – derivate(algorithm in C)

Polinom – derivate(algorithm in C)

#include<stdio.h>
#include<conio.h>

int a[20],i,j,k,n,l;
void main()
{
  printf("Gradul polinomului<20:");scanf("%d",&n);
  for(i=0;i<=n;i=i+1)
  {  printf("a(%d)=",i);scanf("%d",&a[i]); }
  printf("Se deriveaza de :");scanf("%d",&k);
  for(j=0;j<k;j++)
  {
     a[j]=0;
     for(i=j+1;i<=n;i++)
     {
       a[i]*=(i-j);
       if(i<n)
         printf("%dx^%d+ ",a[i],(i-j-1));
       else
         printf("%dx^%d\n",a[n],(i-j-1));
	    }
  }
  getch();
}

252,338 total views, 48 views today