Write a to print value of cos(0) to cos(180) using math function.
// Use of math function
#include<math.h>
#define PI 3.14
#define MAX 180
main() {
int angle;
float x, y;
angle = 0;
printf(" Angle cos(angle)\n\n");
while(angle <= MAX) {
x = (PI/MAX)*angle;
y = cos(x);
printf("%15d %13.4f\n", angle, y);
angle += 10;
}
}
0 Comments