我在数组中输入。但是循环取值超过条件并且不将这些值存储在数组中。我被困在这里
当我在x []数组上输入时,它需要比条件多1个输入。
这是我的代码
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i,j,n;
printf("How much number you have? : ");
scanf("%d",&n);
float x[n];
float FofX[n][n];
float x_variable;
i=0;
printf("Enter values of x \n\n");
while(i!=n){
printf("When n is %d and i is x[%d]: ",n,i);
scanf("%f ",&x[i]);
printf("\n");
i++;
}
i=0;
while(i!=n){
printf("x[%d]= %d \n",i,x[i]);
i++;
}
i=0;
printf("Enter values of f(x) \n");
while(i!=n){
printf("When n is %d and i is [%d]: ",n,i);
scanf("%f",&FofX[i][0]);
i++;
}
printf("\nInput value of a variable point\n");
scanf("%d",&x_variable);
printf("Hello world!\n");
return 0;
}