To solve the problem, you can implement three approaches:
Go to Yandex and enter the query - "the function of calculating the tangent of C". The answer to the question is instant.
Search for the definition of trigonometric functions in the built-in help IDE in which you work.
Replace sin(x)
in the program with sin(x)/cos(x)
.
But first you need to debug the source program. Then try to replace the sine with the cosine, make sure that everything works.
But then you need to understand the difference between the sine function and the tangent - you do not want to look for the definition of tangent in Xi, well and good. By the way, here's another 4th option - why not just find the file math.h on your disk and see the definitions of the functions there.
I can suggest that each function has a domain and a domain of change. In the case of a sine, the range of change is from -1 to +1. And tangent? And what is equal to the tangent pi / 2? Mechanical replacement of the sine for the tangent - will not work!
This is how the sine plot should look (gcc, MacOSX).
#include <stdio.h>; #include <math.h>; main() { int i,j,n,m; float x,h; char z[80]; x=0; h=3.14159/24; for (i=0;i<=48;i=i+1) { x=i*h; m=40+30*sin(x); for(j=0;j<m;j=j+1) printf(" "); printf("*\n"); } }