Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- using namespace std;
- int NWD(int a,int b)
- {
- int r;
- r=a%b;
- while(r!=0)
- {
- a=b;
- b=r;
- r=a%b;
- }
- return b;
- }
- int main(int argc, char** argv) {
- int a,b;
- ifstream odczyt("ryt.txt");
- ofstream zapis("lul.txt");
- odczyt>>a>>b;
- cout<<a<<" "<<b;
- cout<<endl<<"nwd wynosi "<<NWD(a,b);
- zapis<<"nwd liczab "<<a<<" i "<<b<<" wynosi "<<NWD(a,b);
- odczyt.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment