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
brielle is researching substitution ciphers. she came across a cipher in which the entire alphabet was rotated 13 steps. what ty
kogti [31]

Caesar cipher is a very common type of substitution cipher where each letter in the plaintext is moved or shifted to a known number of places down the alphabet.

The type of cipher is this is ROT13

  • ROT13ROT13 is a simple letter substitution cipher. It functions by the replacement of a letter with the 13th letter after it in the alphabet. It is commonly known as Caesar cipher used in ancient Rome

Conclusively we can say that ROT13 is a commonly known Caesar cipher that replaces a letter with the 13th letter after it in the alphabet.

Learn more from

brainly.com/question/15300028

3 0
3 years ago
Carina is concerned that her computer is slowing down because it doesn’t have enough short-term memory. Which of the following s
steposvetlana [31]
I would say I think RAM? Hope this helps;)
8 0
3 years ago
Read 2 more answers
You are unpacking and setting up workstations
Anestetic [448]

Answer:

For setting up workstations in classrooms, one end of cables connected into the built in NIC and other end will be connected to a drop.

Explanation:

A drop will be used for connectivity in this case, which will work as connection point in a network. Drops are just like outlets in wall having  Ethernet Jacks where a network device or system can be plugged into it.

8 0
3 years ago
When ____ is pressed after entering an email address or web address, Word automatically formats the address as a hyperlink, that
butalik [34]

Answer:ENTER

Explanation: Hyperlink is the situation that states that the document belongs to some other location. So, if the enter key is pressed by the user after the typing of any email address , then it marks it as the hyperlink which shows it belongs to some other file.

Hyperlink actions also occurs when the user presses space-bar and the web address gets marked by the change in color or by underlined function.

4 0
3 years ago
Lonic compounds are also known as <br> a. salts <br> b. valence <br> c.organic <br> d.elements
shutvik [7]
I'm not quite sure but it maybe b
6 0
4 years ago
Read 2 more answers
Other questions:
  • True or False? In cloud computing, the term "Measured service" refers to a billing model in which gaining access to resources do
    12·1 answer
  • "This command will give you a listing of your basic IP information for the computer you are using"
    6·1 answer
  • What type of traffic always goes to all devices in a subnet?
    10·1 answer
  • When you use file explorer or windows explorer to delete a file from the hard drive, where does windows put the file?
    11·1 answer
  • Write a command that will start and run the gedit command in the background.
    8·1 answer
  • The best-known communications protocol is probably smtp, which regulates internet data transport. _________________________
    6·1 answer
  • The "Rudolph Rule" is best described by which of the following?
    9·1 answer
  • The relational database is the primary method for organizing and maintaining data today in information systems. It organizes dat
    9·1 answer
  • A network resource is masquerading as a network server and is causing hosts on the network to send requests to the attacker rath
    11·1 answer
  • What technique is used when setup times at a workstation are sequence dependent?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!