Advertisement
Guest User

c++ NWD

a guest
Feb 9th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <fstream>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int a, b;
  10.  
  11. ifstream plik("dane1.txt");
  12. ifstream plik2("dane2.txt");
  13. ifstream plik3("dane3.txt");
  14.  
  15. while(plik >> a)
  16. {
  17. while(plik >> b)
  18. {
  19. do
  20. {
  21. if(a>b) a=a-b;
  22. else b=b-a;
  23. }
  24. while(a!=b);
  25. }
  26. }
  27. cout << "Najwiekszy wspolny dzielnik: " << a << endl;
  28.  
  29. system("PAUSE");
  30.  
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement