But bhaiya, C Compiler saying something like that,sabbir.yousuf wrote:Okay, here's a somewhat simpler and inefficient version -

Code: Select all

`//we will write a function to calculate sine of a given value //we will use MacLaurin Series for this purpose //sinx = x - x^3 / 3! + x^5 / 5! - ...... double sin(double x) { double res = 0; //result variable int sign = 1; //sign of a particular term in the series, +/- double num = x; //num variable will denote the numerator of a particular term in the series double denom = 1; //denom variable will denote the denominator of a particular term in the series //it's not possible to calculate a infinite sum //it's not necessary either because later terms won't contribute much to the sum //so we will take first 50 odd terms for(int i = 1; i <= 100; i+=2) { res += (sign * num) / denom; // 'res += x' means 'res = res + x' num *= (x*x); //next numerator, note that each term is x^2 more than the previous one denom *= ((i+1)*(i+2)); //next denominator, note that i-th term should be (2*i+1)! sign *= -1; //sign alternates in successive terms } return res; }`

**In function 'sin':**

error 'for' loop initial declaration are only allowed in C99 mod

note:use option -std=c99 or -std=gnu99 to compile your code

=== build finished: 1 errors, o warnings ===

error 'for' loop initial declaration are only allowed in C99 mod

note:use option -std=c99 or -std=gnu99 to compile your code

=== build finished: 1 errors, o warnings ===

i can't understand the first two line.

What can I do for compile it ????

(N.B: I used a main function also)