1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
geniusboy [140]
3 years ago
8

Write a program to calculate surface area and volume of a sphere (ball). The program will ask user to input radius (meter(s)) of

a sphere and return its area and volume (output should round to three decimal places). Use macro #define for value of π (suppose π = 3.1415927). Learn to use pow function for evaluating square and cubic in math.h of C programming library (Google ""pow c programming""). You can use scanf function and double type for radius input. Name your program file Hw2 Q1 Code.c.
Computers and Technology
1 answer:
oee [108]3 years ago
4 0

Answer:

The following program is to calculate the surface area and volume of a sphere(ball) using macro in c language .

#include <math.h>  //header file for math functions

#define pi 3.1415     //using macro

#include <stdio.h>  //header file for printf() or scanf()

int main()   //main function

{  

   double radius;  //radius is a double type variable

   float surface_area, vol;    //surface_area andvolume is a float type variable

   printf("Enter the radius of the sphere : \n");     //printf() is use to print an output

   scanf("%lf", &radius);   //scanf() is use to take input from the user

   surface_area =  4 * pi * pow(radius,2);

   vol = (4.0/3) * pi * pow(radius,3);

   printf("The Surface area of the sphere is: %.3f", surface_area); // display surface area

   printf("\n Volume of the sphere is : %.3f", vol); // display volume

   return 0;  

}

Output:

Enter radius of the sphere : 4.4

Surface area of sphere is: 243.278

Volume of sphere is : 356.807

Explanation:

Here in this program  we  include the header file math.h and include the macro pi. after that taking the user input in radius and calculating the surface area and volume of sphere and finally display the result.

You might be interested in
Does anyone know in adobe photoshop , digital design class , how to make a smart object and copy it to another page!
Licemer1 [7]
I suppose you by page, mean file and if that is the case you can right-click the smart object, press duplicate and in the drop-down menu called 'Destinaton' choose where you want you copy to be placed. You then just choose the file(page) you want it to be transferred to
4 0
3 years ago
In the Dread Pirate Roberts case, U.S. Ulbricht, 31 F. Supp. 3D 54D (S.D.N.Y. 2014), one of the issues that the court addressed
LUCKY_DIMON [66]

Answer:

True.

Explanation:

One of the problems described by that of the court through the Dread Pirate Roberts case was about whether Bitcoin was currency of cash-laundering laws reasons. The following court decided in the following scenario that somebody might breach the money-laundering law through using bitcoin.

So, the following scenario is true about the case of Dread Pirate Roberts.

6 0
3 years ago
Bryan knows that it takes him fifteen minutes to drive to work, or twenty minutes if every traffic light is red on the way there
lisabon 2012 [21]
<span>The answer is "punctuality"; Being on time is respectful to your co-workers and to the organization and is a good workplace habit. It is a sign to others of your reliability, that they can depend on you. Their are many positive that come from is habit, such as clients knowing they can reach someone, or morning meetings that are more productive, or colleagues who are are more efficient not having to cover for you until you arrive.</span>
5 0
4 years ago
Read 2 more answers
We see color because an object that has light striking it
Pachacha [2.7K]
<span>We see color because an object that has light striking it reflects the color we see.  The object </span>has certain chemicals in it that when illuminated,  absorbs the color we see, reflects the color we see, <span>refracts all colors but the one we see.</span>
8 0
4 years ago
Is this website real? Or is it a scam?
nikitadnepr [17]

It's a scam don't buy something

5 0
3 years ago
Other questions:
  • "re-type the celsius_to_kelvin function. Change the name to kelvin_to_celsius, and modify the function accordingly."
    7·2 answers
  • Fluyen en tecnologia
    15·1 answer
  • Explain briefly why people often have a pretty good understanding of computer hardware.
    14·1 answer
  • Show the stack with all activation record instances, including static and dynamic chains, when execution reaches position 1 in t
    14·1 answer
  • Which part of the Word application window should the user go to for the following activities?
    14·1 answer
  • Worth 30 pts
    9·2 answers
  • What G-Suite Apps integrate with Forms
    14·2 answers
  • Rewrite the following using if else statement:
    14·1 answer
  • HTML, the markup language of the web, specifies colors using the RGB model. It uses a two-digit hexadecimal (that is, base 16) r
    13·1 answer
  • What are LinkedIn automation tools used for?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!