int main()
{
int i=0;
int j=0;
int k=0;
int sum=0;
int n=0;
for(i=1;i<5;i++)
{
for(j=1;j<5;j++)
{
for(k=1;k<5;k++)
{
if(i!=j&&j!=k&&k!=i)
{
printf("%d%d%d ",i,j,k);
sum++;
}
}
}
}
if(n%10==0)
printf("\n");
printf("sum=%d\n",sum);
return 0;
}
include <stdio.h>
int main()
{
int n = 0;
int a = 0;
int index = 0;
int sum = 0;
int cur=0;
printf("最多输入几项:");
scanf("%d", &n);
printf(" 输入一个基数:");
scanf("%d", &a);
for (index = 0; index < n; index++)
{
cur = cur * 10 + a;
}
sum += cur;
printf("sum=%d\n", sum);
return 0;
}
时间: 2024-10-11 19:47:58