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]
2 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]2 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 does CS mean? idk
Rainbow [258]
Computer science or computer software
3 0
2 years ago
Read 2 more answers
What is wrong with each of the following?
ankoles [38]

Answer:

The answer to this question is given below in the explanation section

Explanation:

shoNum + shoNum2 = shoTotal

in this code statement,  the order of operation is wrong because the calculation in programming always done at the right side of dependent variables.  so the correct statement of code is

<em> shoTotal = shoNum + shoNum2;</em>

shoNum = 10 * 4

This statement is programmatically correct, because the ShoNum value becomes 40 after performing the multiplication operation on its assigned value  (10 multiply by 4). However, it is noted that the empty space mostly ignored by the compiler. So, the correct is <em>shoNum = 10*4;</em>

Dim decPrice As Decimal = "$4.99"

The dollar sign is appeared in along with its value. So, if you assign value to a decimal variable, you need to assign only digit value (do not mix value with symbol or text) and also do not put quotation marks around value, if you put quotation marks around value then this value will be consider as a text value.

So, the correct statement is :

<em>Dim decPrice As Decimal = 4.99;</em>

shoCube= (shoSide)3

In this statement, cube is calculated of shoSide variable, mathematically it is right, but programmatically it is incorrect. Because, you missed the multiplication operation (*) between the operand shoSide and 3. it should

be as  shoSide raise to power 3.

the correct statement is : shoCube = (shoSide * shoSide *shoSide);

4 0
3 years ago
Identify any eight new programming languages and classify them based on their functionality.
shepuryov [24]

Answer:

Some of the new programming languages are R, Python, Haskell, Swift, C++, Java, Javascript and PHP.

However, you should know that in general sense there are three types of programming languages.

R is a pure object-oriented programming language being used for scientific purposes, and now it is being used extensively for machine learning as well.

Python is also a pure object-oriented programming language, and it is being used for mainly machine learning. However, you need to keep in mind that it supports the functional programming paradigm as well.

Haskell is a functional programming language and is the best in the functional paradigm as well. You can compare it with LISP, FORTRAN and PASCAL or COBOL, and you will find that Haskell is the best.

Swift is a pure object-oriented programming language, And by pure it means it never cheats anybody like if it says a variable is an int, it will be an int and not like C# here a string data type can be an integer data type. And this is not the correct thing. However, if you study in deep, you will find it is a necessary evil.

C++ and Java are imperative programming languages.

The Javascript and PHP are the scripting languages that support the object-oriented programming concepts but not fully, and they too fall under the imperative programming language list.

Explanation:

The answer is self explanatory.

4 0
2 years ago
Read 2 more answers
Discuss two advantages and two disadvantages of agile methods
Fofino [41]

Answer:

Two advantages of the agile methods are:

  • The agile method require less documentation process as compared to waterfall model and saves maximum time and money. It basically reduces the efforts and the amount of work.
  • In agile method, there is always high customer satisfaction present. In agile method, it is easy to modify in the data as compared to the waterfall model. The customers and developers always interact with each other as the interaction is very important for the good results in the project.

Two disadvantages of the agile methods are:

  • For the large and complex projects, sometimes it is difficult to determine the requirements in the software development as projects are easily go off track.
  • There is less predictability and the projects are easily messed up if the projects requirement are not clear by the customer end.

6 0
3 years ago
What are the functions of online gaming communities?
romanna [79]

Answer:

As a high-quality communication system, online games provide a virtual world where gamers communicate with each other by using rich interactive multimedia. This would facilitate communication among online gamers and enhance the development and maintenance of interpersonal relationships.

6 0
2 years ago
Other questions:
  • Your company is developing a new marketing campaign and wants to know which customers have never placed an order. You will need
    10·1 answer
  • Which information technology job has the lowest predicted 10-year growth? computer programmer software developer computer suppor
    13·1 answer
  • What need most led to the creation of the Advanced Research Projects Agency Network? DARPA wanted scientists to be able to colla
    10·2 answers
  • Pls help brainliest
    12·1 answer
  • Write a function called missing_letters that takes a string parameter and returns a new string with all the letters of the alpha
    7·1 answer
  • The IBM nine-track tapes that became the industry standard for storage for three decades had several sizes , the most common bei
    13·1 answer
  • Importance of producing a hardcopy output​
    15·1 answer
  • If you set the Decimal Places property to 0 for a Price field, and then enter 750.25 in the field, what does Access display in t
    5·1 answer
  • Write essay about pokhara​
    5·1 answer
  • Do small companies need computers? why?<br>​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!