2 like 0 dislike

Write a program that computes the volume of a sphere with a radius, using the formula v=(4.0/3.0)*r*r*r*3.141592 . Remember to keep the fraction 4.0/3.0 but not 4/3
The program should output 2 digits after decimal point.

寫一個計算球形體積程式,用這個公式v=(4.0/3.0)*r*r*r*3.141592。

分數寫法4.0/3.而不是4/3

Example input:

10

Example output:

4188.79
[Exercise] Coding (C) - asked in Chapter 2: C Fundamentals by (11.3k points)
Available when: Unlimited - Due to: Unlimited

edited by | 484 views

50 Answers

0 like 0 dislike
Hidden content!
#include<stdio.h>

int main()
{
* * *** ** * * * ** r,v;
* ** * ** * * *** * *** * ** ** * * * *** ***
* ** * ** ** ** * * ** ** ** * ** *
* **** * *** ***** ** *** * ****** ** *
****** * ** * ** * * 0;
}
answered by (82 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
** * ** ** ** *

*** * ** **** *
* *** PI * *
int main (){
float r,v;

*** * * *** * * * * **
* ******* * * *
*** * * * **
** **** * * = ** *** * **

0;
}
answered by (16 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 like 0 dislike
Hidden content!
#include * *** **
#include <math.h>

#define PI 3.141592

int main(){
****** * * *** ** ** * * r;
* ** ** * * *** **** v;
* **** * ** * **** *
* * * ** ** * * ***** *** *** **** * * ** *
** ****** *** * * * ****
***** *** * * * * = (4.0/3.0)*r*r*r*PI;
* ** ** * * ******* * *
* * * * ** ** * ** ** * *** ****** ***
** *** * * ** ** *
* * * * *** ** 0;
}
answered
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
** * * *
** * ** ** *
int r;
float v;
*** ***** * * * **
* ******** ***
** ** * * **** *** * *** **** **** * **

return 0;
}
answered by (-32 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
* * *** *****

int main()

{
* ** ** ******* * ** * r,pi,v;
*** **** ***** ** **** * ** * * \n");*/
    ** *** **** *** *** *** **
** ** * ** *** ** * * *** ** ** **** *
* * **** ** **** * *** *** *** *** *

}
answered by (-32 points)
edited by
0 0
prog.c:3:1: warning: return type defaults to 'int' [-Wimplicit-int]
 main()
 ^~~~
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
** * *** * ** ***
int main()
{
** ** * * * ** r,v=0;
* * * * *** ** ** * ** **** *** * * ** *
* * ** ***** * * ** * * * * * ** * ** * ** * * * * **
}
answered by (-214 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
# include * *** * * *
# include ** * * * ***

int main()
{
* * **** ** **** *** ** * ** r,volume;

* **** * * ***** ** * * ** * * * * *

* * * ** *** ** **** *** ** ** **

* ***** * ** * *** *** ** * ** * * ***

** *** * * * *** * ******* * 0;
}
answered by (-16 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>

int main()

{
** * ** ** * **** rad,vol;
* ** ***** ** ** ** * * * * *** *** ** * **

* * ** ** * ******** ** * **** * ****
* * ***** ****** * * ** ********** *** * *
** **** * * * ** * * * 0;

}
answered by (-249 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
* * * * * **** * ***
* * ** * ** 4.0/3.0
** * ** 3.14f
int main()
{
* * * ** *** ** ** radius;
* * * **** ** ** * *
*** * *** * *** * ** ** **** * * ** ****
** * **** * * ** ** = * * * radius * radius * radius * * ***
** *** * ***** * ** *** ** * * *
* ** ** * ** * 0;


}
answered by (-167 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
#include * *** * ***
int main ()
{
*** *** * ****** * ***** * ** r;
** * * *** * ** *** * v;

*** * * * ** * ** *** * * * * ** ** *** * & r);

* * * ** * * * **** = (4.0/3.0)* ******
** * * ** * * * ** ** *** * * ** * * v);

* **** * * * ** * * **** **** ** 0;
}
answered by (-167 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Get it on Google Play Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.68.65.60
©2016-2020

Related questions

4 like 1 dislike
61 answers
[Exercise] Coding (C) - asked Sep 28, 2017 in Chapter 2: C Fundamentals by thopd (11.3k points)
Available when: Unlimited - Due to: Unlimited
| 650 views
1 like 0 dislike
73 answers
[Exercise] Coding (C) - asked Sep 28, 2017 in Chapter 2: C Fundamentals by admin (9.9k points)
Available when: Unlimited - Due to: Unlimited
| 586 views
10,551 questions
115,539 answers
103,526 comments
3,771 users