;voidmain(){ cout<<"学号:"<<endl;?cout<<"========================================="<<endl;?intx,y,z,gy,gb;?intmax(intm,intn);?intmin(intm,intn);?cout<<"请输入2个正整数:";?cin>>x>>y;?if(x<y)?{?z=x; x=y; y=z;}?gy=max(x,y);?gb=min(x,y);?cout<<"最大公约数是:"<<gy<<endl;?cout<<"最小公倍数是:"<<gb<<endl;}intmax(intm,intn){?intt;?t=m%n;?while(t!=0)?{ m=n; n=t; t=m%n;?}?returnn;}intmin(intm,intn){?intmax(int,int);?return(m*n)/max(m,n);}5.#include<iostream>usingnamespacestd;voidmain(){ cout<<"学号:"<<endl;?cout<<"========================================="<<endl;?intm,n,i,j,sum;?sum=0;?boolfact(inti);?cout<<"请输入2个正整数m,n:";?cin>>m>>n;?for(i=m;i<=n;i++)if(fact(i))?sum=sum+i;?cout<<m<<"~"<<n<<"之间所有完数之和为:"<<sum<<endl;}?boolfact(intm){?intsum=0,i;?for(i=1;i<m;i++) if(m%i==0) sum=sum+i;?if(sum==m) returntrue;?else returnfalse;}