欧美一区二区三区,国内熟女精品熟女A片视频小说,日本av网,小鲜肉男男GAY做受XXX网站

輸入一個半徑

榮姿康2年前16瀏覽0評論

輸入一個半徑?

# include <stdio.h>

# include <stdlib.h>

# define PI 3.14159

int main(void)

{

double r, c, s1, s2, v;

printf("輸入圓的半徑:\n\a");

scanf("%lf", &r);//這里有變動,雙精度浮點型(double)輸入是用%lf

c = PI * 2.0 * r;

s1 = PI * r * r;

s2 = 4.0 * s1;

v = (4 * PI * r * r * r)/3.0;

printf("周長 = %lf\n圓面積 = %lf\n球面積 = %lf\n球體積 = %lf\n", c, s1, s2, v);

return 0;

}

想保留最后兩位:可以這樣

# include <stdio.h>

# include <stdlib.h>

# define PI 3.14159

int main(void)

{

double r, c, s1, s2, v;

printf("輸入圓的半徑:\n\a");

scanf("%lf", &r);//這里有變動,雙精度浮點型(double)輸入是用%lf動 ,%.2lf

c = PI * 2.0 * r;

s1 = PI * r * r;

s2 = 4.0 * s1;

v = (4 * PI * r * r * r)/3.0;

printf("周長 = %.2lf\n圓面積 = %.2lf\n球面積 = %.2lf\n球體積 = %.2lf\n", c, s1, s2, v);//這里改動了,看看%.2lf

return 0;

}

圓的半徑java表達,輸入一個半徑