这个for循环中scanf函数不应该循环三次吗?为什么运行时会循环四次?

#include<stdio.h>
#include<stdlib.h>
struct SoilLayerParameter{
double VolumeWeightOfSoil;
double InternalFrictionAngle;
double CohesiveStrength;
}*SoilParameter;
struct coordinate {
double x;
double y;
}Axis[1000];
int main(void)
{
int SoilLayerNumber=0;
int i=0,j=0;
char ch='0';
printf("输入土层数\n");
scanf("%d",&SoilLayerNumber);
struct SoilLayerParameter *SoilParameter=(struct SoilLayerParameter *)calloc(SoilLayerNumber,sizeof(double));
printf("输入土层重度\n");
for(i=0;i<SoilLayerNumber;i++){
scanf("%lf\n",&(SoilParameter[i].VolumeWeightOfSoil));
}
/printf("输入土层内摩擦角");
printf("输入土层黏聚力");
double SlopeHeight=0;
scanf("%lf",&SlopeHeight);
/
while(j<SoilLayerNumber){
printf("%lf\n",SoilParameter[j].VolumeWeightOfSoil);
j++;
}
}

修改处见注释,供参考:

#include<stdio.h>
#include<stdlib.h>
struct SoilLayerParameter{
    double VolumeWeightOfSoil;
    double InternalFrictionAngle;
    double CohesiveStrength;
}*SoilParameter;
struct coordinate {
    double x;
    double y;
}Axis[1000];
int main(void)
{
    int SoilLayerNumber=0;
    int i=0,j=0;
    char ch='0';
    printf("输入土层数\n");
    scanf("%d",&SoilLayerNumber);
    SoilParameter=(struct SoilLayerParameter *)calloc(SoilLayerNumber*3,sizeof(double));//修改
    //struct SoilLayerParameter *SoilParameter=(struct SoilLayerParameter *)calloc(SoilLayerNumber,sizeof(double));
    printf("输入土层重度\n");
    for(i=0;i<SoilLayerNumber;i++){
        scanf("%lf",&SoilParameter[i].VolumeWeightOfSoil); //修改 "%lf\n" 多了 '\n' .
        //scanf("%lf\n",&(SoilParameter[i].VolumeWeightOfSoil));
    }
    //printf("输入土层内摩擦角");
    //printf("输入土层黏聚力");
    //double SlopeHeight=0;
    //scanf("%lf",&SlopeHeight);/
    while(j<SoilLayerNumber){
          printf("%lf\n",SoilParameter[j].VolumeWeightOfSoil);
          j++;
    }
    return 0;
}

输入4吗