• 2023-05-225.22
    #include<stdio.h>main(){intm,n,temp,i;printf("Inputm&n:");scanf("%d%d",&m,&n);for(inti=1;;i++){if(i%m==0&&i%n==0){printf("%d",i);break;}}return0;}
  • 2023-05-215.20
    #include<stdio.h>main(){intm,n,temp,i;printf("Inputm&n:");scanf("%d%d",&m,&n);if(m<n){temp=m;m=n;n=temp;}for(i=n;i>0;i--)if(m%i==0&&n%i==0){printf("TheGCDof%dand%dis:%d\n",m,n,i);brea
  • 2023-05-185.18
    #include<stdio.h>main(){inti,x,y,last=1;printf("Inputxandy:\n");scanf("%d%d",&x,&y);for(i=1;i<=y;i++)last=last*x%1000;printf("Thelastthreedigitsis:%d\n",last);}
  • 2023-05-175.17
    #include<stdio.h>main(){inti,t,k,a[3]={0};printf("TherearefollowingArmstrongnumbersmallerthan1000:\n");for(i=2;i<1000;i++){t=0;k=i;while(k){a[t]=k%10;k=k/10;t++;}if(i==a[0]*a[0]*a[0]+a[1]*a[1]*a[1]+a[2]*a[2]*a[2])printf("%
  • 2023-05-115.11
    #include<stdio.h>main(){inti,j,s,n;printf("请输入所选范围上限:");scanf("%d",&n);for(i=2;i<=n;i++){s=0;for(j=1;j<i;j++){if(i%j==0)s+=j;}if(s==i)printf("Itisaperfectnumber:%d.\n",i);}}
  • 2023-05-105.10
    #include<stdio.h>main(){intx,y,z,number=0;printf("MenwomenChildren\n");for(x=0;x<=10;x++){y=20-2*x;z=30-x-y;if(3*x+2*y+z==50)printf("%2d:%4d%5d%6d\n",++number,x,y,z);}}
  • 2023-05-095.9
    #include<stdio.h>#include<math.h>main(){doublesum=0;inti;for(i=1;i<=64;i++)sum=sum+pow(2,i-1);printf("国王总共需要赏赐给宰相的麦子数为:\n%f\n",sum);}
  • 2023-04-284.28
    #include<stdio.h>main(){intm,n,number=0;printf("红球白球黑球\n");printf("......................\n");for(m=0;m<=3;m++)for(n=0;n<=3;n++)if(8-m-n<=6)printf("%2d:%d%d%d\n",++number,m,n,8-m-n);}