समस्या
0 से 150 तक हर 10 डिग्री के लिए कोसाइन और साइन मान खोजना।
समाधान
कोसाइन मान खोजने के लिए उपयोग की जाने वाली लॉजिक:
प्रोग्राम की शुरुआत में MAX और PI मान घोषित करें।
while(angle <= MAX) {
x = (PI/MAX) * angle;
y = cos(x);
printf("%15d %13.4f\n", angle, y);
angle = angle + 10;
}
साइन मान खोजने के लिए उपयोग की जाने वाली लॉजिक:
प्रोग्राम की शुरुआत में MAX और PI मान घोषित करें।
while(angle <= MAX) {
x = (PI/MAX) * angle;
y = sin(x);
printf("%15d %13.4f\n", angle, y);
angle = angle + 10;
}
उदाहरण: कोसाइन मान
कोसाइन मान खोजने का C प्रोग्राम:
// कोसाइन मान
#include <stdio.h>
#include <math.h>
#define PI 3.1416
#define MAX 150
main() {
int angle;
float x, y;
angle = 0;
printf("कोण cos(कोण)\n\n");
while(angle <= MAX) {
x = (PI/MAX) * angle;
y = cos(x);
printf("%15d %13.4f\n", angle, y);
angle = angle + 10;
}
}
आउटपुट
कोण cos(कोण) 0 1.0000 10 0.9781 20 0.9135 30 0.8090 40 0.6691 50 0.5000 60 0.3090 70 0.1045 80 -0.1045 90 -0.3090 100 -0.5000 110 -0.6691 120 -0.8090 130 -0.9135 140 -0.9781 150 -1.0000
उदाहरण: साइन मान
साइन मान खोजने का C प्रोग्राम:
// साइन मान
#include <stdio.h>
#include <math.h>
#define PI 3.1416
#define MAX 150
main() {
int angle;
float x, y;
angle = 0;
printf("कोण sin(कोण)\n\n");
while(angle <= MAX) {
x = (PI/MAX) * angle;
y = sin(x);
printf("%15d %13.4f\n", angle, y);
angle = angle + 10;
}
}
आउटपुट
कोण sin(कोण) 0 0.0000 10 0.2079 20 0.4067 30 0.5878 40 0.7431 50 0.8660 60 0.9511 70 0.9945 80 0.9945 90 0.9511 100 0.8660 110 0.7431 120 0.5878 130 0.4067 140 0.2079 150 -0.0000