Greetings to all

I'm pretty much new to programming in C, so please excuse my mistakes. Since I'm a physics student, I mostly do applications of mathematical formulas and such. I've written a short code which should compute any Legendre polynomial for any l>0, using the formula P_l= ((2l+1)/l)*x*P_1- ((l-1)/l)*P_0.

I've developed the code in Dev-C++, and I can compile and run it. But whenever I type in the numbers needed, the program just closes abruptly! I honestly don't know what's the problem here, and that's why I'm posting this. If anyone could give me a hint, I would be most grateful. Thanks in advance!

Code:#include <stdio.h> int main(void){ int l, i; float x, P[l]; P[0]==1; P[1]==x; printf("Type in l i x\n"); scanf("%n %f", &l, &x); if(l=0) printf("P = 1\n"); else if(l=1) printf("P = x\n"); else if(l>1) {for(i=1; i<l; i++) {P[l]=((2*l+1)/l)*x*P[1]-((l-1)/l)*P[0]; P[0]==P[1]; P[1]==P[l];} printf("The polynomial is: %f", P[l]);} getchar(); getchar(); return 0;}