Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <complex>
- int main()
- {
- int n;
- std::cout<<"Unesite broj elemenata:\n";
- std::cin>>n;
- double re, im;
- std::complex<double> Z;
- std::complex <double> priprema (0,0);
- int i(0);
- while (i!=n)
- {
- std::cout<<"R" << i + 1<< " = " <<std::endl;
- std::cin>>re;
- std::cout<<"X" << i + 1 << " = " << std::endl;
- std::cin>>im;
- std::complex<double> z(re, im);
- priprema+=std::complex<double> (1,0)/z;
- i++;
- }
- Z=std::complex<double> (1,0)/priprema;
- std::cout<< "Paralelna veza ovih elemenata ima R = " << Z.real() << " i " << Z.imag() << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment