有人可以解释为什么这两个变量"area"和"peri"输出0.000000?
int main()
{
double length, width, peri = (length*2) + (width*2), area = length*width;
printf("Enter the length of the rectangle in centimeters: ");
scanf("%lf", &length);
printf("\nEnter the width of the rectangle in centimeters: ");
scanf("%lf", &width);
printf("The perimeter of the rectangle is %lf cm.\nThe area of the rectangle is %lf cm.", circ, area);
return 0;
}
Run Code Online (Sandbox Code Playgroud) c ×1