Advertisement
Guest User

Untitled

a guest
Apr 8th, 2020
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.12 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4.  
  5. void  ispisiPovrsinu(float povrsina);
  6. void  ispisiOpseg(float opseg);
  7. float izracunajPovrsinu(int stranica, int kut);
  8. float izracunajOpseg(int stranica);
  9.  
  10. int main()
  11. {
  12.     int stranica, kut;
  13.     float opseg, povrsina;
  14.    
  15.     printf("Unesi stranicu romba: ");
  16.     scanf("%d", &stranica);
  17.    
  18.     printf("Unesi kut između stranica: ");
  19.     scanf("%d", &kut);
  20.     printf("\n");
  21.    
  22.     povrsina = izracunajPovrsinu(stranica, kut);
  23.     opseg    = izracunajOpseg(stranica);
  24.    
  25.     printf("Površina romba je: ");
  26.     ispisiPovrsinu(povrsina);
  27.    
  28.     printf("Opseg romba je: ");
  29.     ispisiOpseg(opseg);
  30.    
  31.     return 0;
  32. }
  33.  
  34. float izracunajPovrsinu(int stranica, int kut){
  35.     float povrsina;
  36.     float x = M_PI / 180;
  37.    
  38.     povrsina = (pow(stranica, 2) * sin(kut*x));
  39.     return povrsina;
  40. }
  41.  
  42. float izracunajOpseg(int stranica){
  43.     float opseg;
  44.    
  45.     opseg = 4*stranica;
  46.     return opseg;
  47. }
  48.  
  49. void ispisiPovrsinu(float povrsina){
  50.     printf("%.3f\n", povrsina);
  51. }
  52.  
  53. void ispisiOpseg(float opseg){
  54.     printf("%.3f\n", opseg);
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement