1.从1遍历到40;
2.若与40的最小公因数为1则输出
#include<iostream>
using namespace std;
int g(int m,int n){
if(m<m){swap(m,n);}
int t=1;
while(t){
t=m%n;
m=n;
n=t;
}
return m;
}
int main(){
int num=0;
for(int i=1;i<40;i++){
if(g(40,i)==1){printf("%2d/40 ",i);num++;}
if(num%4==0)printf("\n");
}
}
标签:真分数,int,35,num,40,printf,day From: https://www.cnblogs.com/drz1145141919810/p/17421570.html