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
When you pass an argument to a method, the argument's data type must be ____________ with the receiving parameter's data type?
Sedbober [7]
Any time you pass an argument to a method, the data type arguments must be assignment compatible with data type receiving parameter.
<span />
6 0
3 years ago
BitTorrent, a P2P protocol for file distribution, depends on a centralized resource allocation mechanism through which peers are
ch4aika [34]

Answer:

yes. it is true. mark as brainlest

8 0
2 years ago
Which statement about intellectual property is true? (CSI-7.6) Group of answer choices It is okay to use code you find on the in
nika2105 [10]

Answer:

Laws are in place to cover your creative work, which includes code you have written.

Explanation:

Copyright law can be defined as a set of formal rules granted by a government to protect an intellectual property by giving the owner an exclusive right to use while preventing any unauthorized access, use or duplication by others.

A copyright can be defined as an exclusive legal right granted to the owner of a creative work (intellectual property) to perform, print, record, and publish his or her work. Also, the owner is granted the sole right to authorize any other person to use the creative work.

For instance, copyright law which protects the sharing and downloading rights of music is known as the Digital Millennium Copyright Act (DMCA).

An intellectual property can be defined as an intangible and innovative creation of the mind that solely depends on human intellect.

Simply stated, an intellectual property is an intangible creation of the human mind, ideas, thoughts or intelligence. They include intellectual and artistic creations such as name, symbol, literary work, songs, graphic design, computer codes, inventions, etc.

Hence, laws are in place to cover a person's creative work, and it includes code he or she have written.

6 0
3 years ago
Which of the following commands would I use to begin a new presentation?
ki77a [65]

Answer:

begin >new

Explanation:

just trust me ok hehe

7 0
3 years ago
How can I make a video game?
Rainbow [258]
You first need to figure out what kind of game you would like to create. Find codes and certain websites that will help you set up and or make a game.
3 0
2 years ago
Read 2 more answers
Other questions:
  • The main advantage of a solid state drive is:
    5·1 answer
  • Complete method printPopcornTime(), with int parameter bagOunces, and void return type. If bagOunces is less than 2, print "Too
    5·1 answer
  • Assume phrase= "Peter Piper picked a peck of pickled peppers", What will be returned if phrase.search(/[aeiou]/) is called?
    9·1 answer
  • Vicky is investigating multiple hacking attempts on her cloud-based e-commerce web servers. She wants to add a front-end securit
    5·1 answer
  • A range check that can be used in Microsoft access to calculate the data collected which is date and time
    10·1 answer
  • A location in memory which stores a value, the value can change as the program is running is
    12·1 answer
  • 2 red and 2 overlapping balls in the center are surrounded by a green, fuzzy, circular cloud with a white line running through i
    15·2 answers
  • Web résumés allow you to include extra graphics and images that you would not include in a traditional résumé. please select the
    9·1 answer
  • Look at the code in the example below, and then answer the question.
    9·1 answer
  • Task 2
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!