1

Blockquote

#include<stdio.h>
char a;
int degree;
void integration();
double *p;
int i;

int main(void){

  //getting info from users
  printf("please enter your variable here:\n");
  scanf(" %c",&a);
  printf("please enter the highest degree of the polynomial:\n");
  scanf("%i",&degree);
  double coiffe[degree];
 p=coiffe;

 //getting coifficients
 for(i=degree;i<=0;i++){
    printf("what is the coifficient of %c^%i",a,i);
    scanf("%lf",p+i);
 }


 integration();
 }


 void integration(){
 double j=0;
 for(i=degree;i<=0;i++){
 j=i+1;
 *(p+i)/=j;
 printf("integrated value is %lf%c^%lf",*(p+i),a,j);

 }
 }
1
  • I tried to write a program for polynomial integration. It works and compiles just fine till asking for the highest degree of polynomial but just stops after then. Jan 28 '18 at 21:01
1

for(i=degree;i<=0;i++)

This loop will only run if degree is a negative number. Is that what you are expecting?

I suspect you want to run it degree-times, in which case:

for (i = 0; i < degree; i++)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .