Advertisement
bolji_programer

Matematicki algoritmi - Euklidov algoritam (NZD)

Jan 7th, 2018
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.22 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int NZD(int a, int b)
  5. {
  6.     if (a==0) return b;
  7.     return NZD(b%a,a);
  8. }
  9.  
  10. int main()
  11. {
  12.     int a,b;
  13.     cin>>a>>b;
  14.  
  15.     cout<<"NZD: "<<NZD(a,b)<<endl;
  16.  
  17.     return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement