Advertisement
Adijata

kompleksni i konjugovani

Aug 25th, 2014
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.61 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4.  
  5. struct Kompleksni
  6. {
  7.     int re;
  8.     int im;
  9. };
  10.  
  11. int funkcija(struct Kompleksni niz[], int velicina)
  12. {
  13.     int i,j,br=0;
  14.     for(i=0; i<velicina; i++)
  15.     {
  16.         for(j=0; j<velicina; j++)
  17.         {
  18.             if(niz[i].re==niz[j].re && niz[i].im==(-(niz[j].im)))
  19.                 br++;
  20.         }
  21.     }
  22.     return br/2;
  23. }
  24.  
  25. int main()
  26. {
  27.     struct Kompleksni niz[8]={{2,5}, {2,-5},{1,-6},{3,4}, {1,6}, {4,8}, {4,-8}};
  28.  
  29.     int br;
  30.     br=funkcija(niz, 8);
  31.  
  32.  
  33.         printf(("broj kompleksnih brojeva koji imaju konjugovanu vrijednost: %d "), br);
  34.  
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement