Hadix

Zadanie 1 Lista 2 INF

Mar 6th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.58 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4. #include <time.h>
  5.  
  6.  
  7. int main()
  8.  
  9. {
  10.     int n;
  11.     srand(time(0));
  12.     n = rand() % 12 + 2;
  13.     printf("Wylosowana liczba n: %i\n", n);
  14.    
  15.         int i;
  16.         for(i=0; i<n; i++)
  17.         {
  18.             int angle = 30*i;
  19.             double f1;
  20.             f1 = cos(angle*M_PI/180.0);
  21.             printf("%d", angle);
  22.             printf("cos = %f\n", f1);
  23.            
  24.             double f2;
  25.             f2 = sin(angle*M_PI/180.0);
  26.             printf("%d", angle);
  27.             printf("sin = %f\n", f2);
  28.            
  29.             double f3;
  30.             f3 = tan(angle*M_PI/180);
  31.             printf("%d", angle);
  32.             printf("tan = %f\n", f3);
  33.         }          
  34.     return 0;
  35. }
Add Comment
Please, Sign In to add comment