The Sine, Cosine of x can be computed as follows.
sin(x) = x - x3/3! + x5/5! - x7/7! + x9/9! ....
cos(x) = 1 - x2/2! + x4/4! - x6/6! + x8/8! ....
Your task is to compute the Sine and Cosine for given values of x (where x is in radians) using the above series upto 5 terms.
Input Format
First line will contain N, the number of test cases. Next N line will contain the input values of x
1<= N <= 50
0 < x < 10
Each value of x can contain upto 2 places of
decimal in radians.
Output Format
2N Lines, corresponding to the N input values of x. For each input, you will output 2 lines.
1st line will be the Sine and the 2nd line will be the Cosine of x.
An error margin of +/- 0.001 will be tolerated while evaluating the answers. Please round off your answer to 3 decimal places.
Sample Input
5
2.83
3.24
0.99
2.74
5.04
Sample Output
0.309
-0.943
-0.089
-0.963
0.836
0.549
0.392
-0.914
0.195
2.746
Scoring
If the program output matches the expected output (permitting a deviation of +/- 0.001 for each output)
This is a codegolf problem.
Score = maxScore* (400 - S)/400
S = min(Number of characters in source code,399)