#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
int a[10],i,n,d[10],power;
float in[10];
clrscr();
printf("Enter the order ofthe polynomial\n");
scanf("%d",&n);
for(i=n;i>=0;i--)
{
printf("Enter the co-efficient of x^%d:",i);
scanf("%d",&a[i]);
}
printf("Given polynomial is\n");
for(i=n;i>=0;i--)
{
if(power<0)
{
break;
}
if(a[i]>0)
{
if(i!=n)
printf(" + ");
}
else if(a[i]<0)
printf(" - ");
else
printf(" ");
printf("%dx^%d",abs(a[i]),i);
}
//To find derivative
for(i=n;i>=0;i--)
d[i]=a[i]*i;
printf("\n Derivative of the given polynomial is\n");
for(i=n;i>=1;i--)
{
if(power<0)
{
break;
}
if(d[i]>0)
printf(" + ");
else if(d[i]<0)
printf(" - ");
else
printf(" ");
printf("%dx^%d",d[i],i-1);
}
getch();
}
the above program only calculate the first derivative, but i need a program which calculates all the derivatives ex 2x^3+2x^2+3x+1 f1= 6x^2+4x+3 f2=12x+4 f3=12
like this i need to modify the program,, but am not getting how to do that,,please help me//
try this