Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define PI 3.14159265
- #define EPS 0.001
- int main (int argc, char** argv) {
- double xStepen, x, gornji, sinus=0;
- long int donji;
- int znak=-1, faktorijel=1, i;
- printf("ugao u stepenima: ");
- scanf("%lf", &xStepen);
- for (i=1; ;i++) { //
- if ((xStepen - i*360) < 0) break; //sredjuje
- } //periodicnost
- if (i > 1) xStepen -= (i-1)*360; //
- x = (PI/180)*xStepen;
- sinus += x;
- do {
- gornji=x;
- donji=1;
- faktorijel+=2;
- for (i=1; i < faktorijel; i++) {
- gornji *= x; //stepenovanje brojioca
- }
- for (i=2; i<=faktorijel; i++) {
- donji *= i; //faktorijelisanje imenioca
- }
- sinus += znak * (gornji/donji);
- znak = -znak;
- } while (gornji/donji > EPS);
- printf("%.3lf", sinus);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement