学习俩个正整数的最大公因数求解,编写运行成功
明日学习标识符,关键字和标点符号
#include<iostream>
using namespace std;
int main()
{
int p,q,r;
cout<<"Please input two integers:" <<endl;
cin>>p>>q;
if(p<q);
{
r=q;
p=q;
q=r;
}
r=p%q;
while(r!=0)
{p=q;
q=r;
r=p%q;
}
cout<<"The maximum common divisor is"<<q<<"."<<endl;
return 0;
}