6如果用户输入将其存储在numbers[0]索引中,然后乘以2它得到它的乘积,我可以解释我想要完成的最简单的方法,12但不是存储12在数组的0索引中,productValue而是需要将其存储为productValue[0] = 1 productValue[1] = 2我我无法让它存储单个整数。我是 C 的新手,所以如果这看起来过于简单,请让我休息一下。我的代码如下:
#include <stdio.h>
#include <string.h>
int main()
{
char numbers[17];
char productValue[8];
int i, x;
printf("Please enter number\n");
scanf("%s", numbers);
for(int i = 1; i <= 16; i += 2)
{
for(int x = 0; x < 8; x++)
{
productValue[x] = (numbers[i] - '0') * 2;
printf("%d\n", productValue[x]);
i += 2;
}
}
}