Hi imagine that I have serie (progression) like
Ai=2Ai-2 - 3Ai-1 for i>=2 (i-2 and i-1 are lower indexes)
A0= 2.5
A1= 1.2

I need a program which counts and write into the field values from 0-19 and after the program frint sum of these values to screen. Thank you for quick help.

What are you expecting the result of that series to be?

Here's ur program:

#include <stdio.h>

int main(void)
{
        float a[20];
        int i;

        a[0] = 2.5;
        a[1] = 1.2;

        printf("The values are: \n");
        for(i=2; i<20; i++)
        {
                a[i] = 2*a[i-2] - 3*a[i-1];
                printf("\n A%d = %f", i, a[i]);
        }

        printf("\n");
        return(0);
}

Cheers :icon_smile:

commented: Don't give away solutions -1
commented: That is not the way to teach people to program +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.