i`m trying to make a program to calculate the product of this serie:
1/2 *1/3 *5/2 *5/6 *8/10 *16/13 *23/24.....
the following program gets compiled without errors but when i execute it pops up a window: prog.exe has encountered a problem..etc...
can anyone help me with this problem
#include<stdio.h>
main()
{
int j,n,*p,*q,num[2][n];
float p1=1,p2=1,rezultati;
printf("sa kufiza");
scanf("%d",&n);
q=&num[0][0];/*assings the adress of element[0][0] to q*/
p=&num[1][0];/*assings the adress of element[1][0] to p*/
*q=1;/*assings 1 to element[0][0]*/
*p=2;/*assings 2 to element[1][0]*/
*(q+1)=1;
*(p+1)=3;
for(j=2;j<n;j++)
{*(q+j)=(*(p+j-2))+(*(p+j-1));/*assigns values to array elements*/
*(p+j)=(*(q+j-2))+(*(q+j-1));}/*assigns values to array elements*/
for(j=0;j<n;j++)
{p1=p1*(*(q+j));/*calculates p1*/
p2=p2*(*(p+j));}/*calculates p2*/
rezultati=p1/p2;
printf("%f",rezultati);/*prints the result*/
system("pause");
}