current position:Home>Why can the bottom area be calculated, but the volume has no value

Why can the bottom area be calculated, but the volume has no value

2022-02-04 16:58:41 CSDN Q & A

Meng Xinqiu belt doesn't know why it's wrong
Attach code
#include<stdio.h>
int main()
{
float PI=3.14159;
float r,h,S,V;
printf("Please input r,h:");
scanf("%f,%f",&r,&h);
S=PIrr;
V=PIrr*h;
printf(" Bottom area =%f\t Cylinder volume =%f\n",S,V);
return 0;

}
Typed 5 and 6, The bottom area is correct, but the volume is always 0.
Please give me some advice




Take the answer :

You put h Output the value of , It should be your wrong input .
Input r and h when , Separate them with commas .
Such as :5,6



Other answers 2:

Did you put a space in the middle of your input


Other answers 3:

You first print see h How much is it , Is it right? 0
When you ask for input r and h Separated by commas , So when you input, do you input according to the format

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/02/202202041658398449.html

Random recommended