求这个C语言的编程

来源:百度知道 编辑:UC知道 时间:2024/06/04 23:23:32
1.将前面的17位数分别乘以不同的系数。从第一位到第十七位的系数分别为:7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 2
2.将这17位数字和系数相乘的结果相加。
3.用加出来和除以11,看余数是多少?
4余数只可能有0 1 2 3 4 5 6 7 8 9 10这11个数字。其分别对应的最后一位的号码为1 0 X 9 8 7 6 5 4 3 2
难不难啊。高分
要求打出前17个数运行下就会出现余数,余数对应的数也可以

#include "stdio.h"

int main()
{
int Num[17];
int coeff[17]={7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2};
int Total=0;
printf("please input 17 numbers:\n");
scanf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d",
&Num[0],&Num[1],&Num[2],&Num[3],
&Num[4],&Num[5],&Num[6],&Num[7],
&Num[8],&Num[9],&Num[10],&Num[11],
&Num[12],&Num[13],&Num[14],&Num[15],
&Num[16]);
for (int i=0;i<17;i++)
{
Total+=Num[i]*coeff[i];
//display the computed process
printf("%d :The Coefficient is %d,the multiplicand is %d,the total is %d.\n",i+1,coeff[i],Num[i],Total);
}
printf("The remainder is %d.\n",Total%11);
return 0;
}

输入的十七个数以空格分开
可以算出余数,
不过"其分别对应的最后一位的号码为1 0 X 9 8 7 6 5 4 3 2"这句不明白意思.

明白你最后一句了
把程序改成这样
#include "stdio.h"

int main()