Exercise: Write an algorithm to generate and write a table with s values of an angle A in radians, using the series of Mac-Laurin truncated, presented below:
A3
A5
A7
sin A = A-6 + 120-5040Conditions: Angle A values should range from 0.0 to 6.3, inclusive, from 0.1 to 0.1.
My code:
#include <stdio.h>
#include <math.h>
int main () {
float A = 0.0, valor_seno;
float aprs_tela;
while (A <= 6.3) {
aprs_tela = A;
A = A - (((pow(A,3) / 6) + (pow(A,5) / 120)) - (pow(A,7) / 5040));
valor_seno = sin(A);
printf("O valor do seno (%.1f) com a série de Mac-Laurin é %.2f\n\n",aprs_tela ,valor_seno);
A = A + 0.1;
}
return 0;
}