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
What are the core scripting and coding technolies used to build ai platforms?
boyakko [2]
<span>Artificial Intelligence is a huge field. </span>
4 0
3 years ago
Few companies today could realize their full-potential business value without updated ________. Select one: a. IT investments ma
Alenkasestr [34]

Answer:

b. IT infrastructures and services

Explanation:

IT infrastructure or information technology infrastructure refers to the various components involved in the functioning of an IT enabled operations. These components include; hardware, software, network resources, etc.

It is usually internal to an organization and deployed within the confines of its own facilities.

6 0
3 years ago
1. What is material science?
Murljashka [212]

Answer:

Explanation:

The study of the properties of solid materials and how those properties are determined by a material’s composition and structure is material science.

6 0
2 years ago
Read 2 more answers
You can easily view the ruler on a document by selecting the Show Ruler button located _____.
Ket [755]
In the “View” tab in the Ribbon.
7 0
3 years ago
Read 2 more answers
Select the correct answer.
Naddika [18.5K]

Answer:

E

Explanation:

4 0
3 years ago
Other questions:
  • The Internet of Things (IoT) is a concept with emphasis on machine-to-machine communications to describe a more complex system t
    10·1 answer
  • A risk handling technique in which the organization chooses to simply do nothing, as the cost of the risk being actualized is lo
    15·1 answer
  • Is the answer a,b,c,d
    8·1 answer
  • A technician has just installed a video card in a PC. The video card is not working, althoughit was working fine on the test ben
    6·1 answer
  • In a Microsoft Office application, what is the area at the bottom of the application screen that contains information about the
    13·1 answer
  • What icons in the toolbar change the look of the presentation text? It’s either Drawing, Formatting,Presentation, or Standard
    9·2 answers
  • 1)Create a conditional expression that evaluates to string "negative" if userVal is less than 0, and "positive" otherwise. Examp
    15·2 answers
  • You are developing a Windows forms application used by a government agency. You need to develop a distinct user interface elemen
    14·1 answer
  • Nia is editing a row in an Access table. The row contains the Pencil icon on the left end of the record
    12·2 answers
  • QUICK HELP ME PLEASE
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!