Help C programming

0 amy123 john · February 16, 2015
Description /images/forum/upload/2015-02-16/438dad14ace43e7dab16b89df084eb24.pngall four question with only a C language 

Post a Reply

Replies

Oldest  Newest  Rating
0 amy123 john · February 16, 2015
#include <stdio.h>
#include <stdlib.h>
#define MAXSIZE 14 // MAXSIZE should be 14 to handle polynomials of degree 13
#define maX(a,b) (a>b?a:b)



void sum(float x, float array[],int num)
{
    int power = num;
    int i;
    float polySum = array[num];
    for (i = num - 1; i >= 0; i--)
    {
        polySum = polySum * x + array;
    }
    printf("\n For x = %f, Sum of the polynomial = %f \n", x, polySum);
}


int main()
{
    float array[4][MAXSIZE];
    int i, j, num[4];
    float array6[MAXSIZE*2], array7[MAXSIZE*2];
    int num6, num7;
    
    for(i = 1; i <= 3; i++) {
        
        printf("Enter the degree of polynomial %d (degree must be less than or equal to 13..!!) \n", i);
        scanf("%d", &num);
        
        
        
        
        /*  Read the coefficients into an array */
        printf("Enter %d coefficients \n", num + 1);
        for (j = num; j >=0; j--)
        {
            scanf("%f", &array[j]);
        }
        
        for(j = 13; j > num; j--)
            array[j] = 0;
        
    }
    
    for (i = 0; i <= MAXSIZE*2; i++) {
        array6 = 0;
        array7 = 0;
    }
    
    for(i = 0; i <= 13; i++) {
        for(j = 0; j <= 13; j++) {
            array6 += array[1] * array[2][j];
            
            array7 += array[3] * array[3][j];
        }
    }
    
    num6 = MAXSIZE*2;
    num7 = MAXSIZE*2;
    
    sum(0.2, array6, num6);
    sum(0.2, array7, num7);
    
    sum(5.3, array6, num6);
    sum(5.3, array7, num7);
    
    sum(7.2, array6, num6);
    sum(7.2, array7, num7);
    
}

is it correct ?? number 3
0 Pere Garau Burguera · February 16, 2015
In order for us to help, you need to provide us something. What have you done? What don't you understand? We will help you, but we will not do anybody's homework. People posting stuff like this don't usually get what they want. 
  • 1

C

107,275 followers
About

One of the most popular languages of all time.

Links
Moderators
Bucky Roberts Administrator