fork(3) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int NWD(int Liczba1, int Liczba2)
  5. {
  6. cout<<Liczba1<<"\t"<<Liczba2<<endl;
  7. int Mod = Liczba1 % Liczba2;
  8. if (Mod == 0)
  9. {
  10. cout<<"\t"<<Liczba1 % Liczba2<<"\t"<<Liczba2<<endl;
  11. return Liczba2;
  12. }
  13. else
  14. {
  15. // cout<<Liczba1<<"\t"<<Liczba2<<endl;
  16. NWD(Liczba2, Mod);
  17. }
  18. }
  19.  
  20. int main()
  21. {
  22. int LTestow;
  23. cin >> LTestow;
  24. while (LTestow--)
  25. {
  26. int Bok1, Bok2, Wynik;
  27. cin >> Bok1 >> Bok2;
  28. // if (Bok1 > Bok2)
  29. Wynik = NWD(Bok1, Bok2);
  30. cout<<"Wynik="<< Wynik<<endl;
  31. // else
  32. // cout << NWD(Bok2, Bok1)<<endl;
  33.  
  34. }
  35. return 0;
  36. }
Runtime error #stdin #stdout 0.02s 5304KB
stdin
2
8 1
9 8
stdout
8	1
	0	1
Wynik=1
9	8
8	1
	0	1