Advertisement
rozman50

Untitled

Nov 18th, 2018
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. /* krajšanje */
  2. int g(int &s, int &i, int &v, int &z) {
  3. int imenovalec = i;
  4. int stevec = s;
  5. v = s * i;
  6.  
  7. z = s % i;
  8. while (z > 0) {
  9. s = i;
  10. i = z;
  11.  
  12. z = s % i;
  13. }
  14. int skupniDelitelj = i;
  15. cout << "Najvecji skupni delitelj je " << skupniDelitelj << endl;
  16. cout << "Okrajšan ulomek: " << imenovalec / skupniDelitelj << " / " << stevec / skupniDelitelj << endl;
  17. return 0;
  18.  
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement