#include <iostream>
#include <conio.h>
#include <math.h>
using namespace std;
main(){
int k, j, derece, girdi;
double pi = 3.14159265;
double cos = 0, sin = 0, f, radyan;
cout << "Dereceyi giriniz: ";
cin >> girdi;
derece = girdi;
derece = (((derece % 360) + 360) % 360);
radyan = (double(derece) / 180 ) * pi;
for(k=0; k < 30; k++){
if( fabs(derece) == 90 || fabs(derece) == 270)
break;
f = 1;
for(j = 1; j <= (2*k); j++){
f = f * j;
}
cos = cos + (pow(-1, k) * pow(radyan, 2*k)) / f;
}
for(k=0; k < 10; k++){
if( derece == 0 || fabs(derece) == 180)
break;
f = 1;
for(j = 1; j <= ((2*k)+1); j++){
f = f * j;
}
sin = sin + (pow(-1, k) * pow(radyan, ((2*k) +1))) / f;
}
cout << "\ncos(" << girdi << ") = " << cos ;
cout << "\nsin(" << girdi << ") = " << sin ;
getch();
}


TUĞGENERAL



Alıntı ile Cevapla
Bu Konuyu Paylaşın !