avukas

Kompleksni (k,K)

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