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
It converts Assembly Language into machine language?​
docker41 [41]

Answer:

An assembler.

Explanation:

Input is (as with any programming language) files with lists of instructions (typically assembler mnemonics), output is a binary format representing these instructions in machine language.

6 0
2 years ago
A device that is connected to the Internet is known as<br> a. Nexus. Backbone. Node. Link.
ikadub [295]
A device connected to the internet is known as a Node.
3 0
2 years ago
Read 2 more answers
How might a company gain followers on Twitter?
Tresset [83]
By sending persuasive / informable and interesting posts to gain followers.
3 0
3 years ago
If David wishes to digitally sign the message that he is sending Mike, what key would he use to create the digital signature
Goshia [24]

The key would he use to create the digital signature is Mike public key.

<h3>Which key is used to sign messages?</h3>

Digital signatures are known to be used via public key. Here, the person is said to be one who is said to produce or creates the digital signature that  uses a private key to encrypt signature-linked data.

The only way to decrypt a data is only with the signer's public key, the key David would use to create the digital signature is Mike public key.

Learn more about  public key from

brainly.com/question/17486027

7 0
1 year ago
After reviewing device security you learn that a malicious user in an airport
NARA [144]

Answer:

Sniffing.

Explanation:

Data theft can be defined as a cyber attack which typically involves an unauthorized access to a user's data with the sole intention to use for fraudulent purposes or illegal operations. There are several methods used by cyber criminals or hackers to obtain user data and these includes DDOS attack, SQL injection, man in the middle, phishing, sniffing, etc.

Sniffing can be defined as a form of cyber attack in which a malicious user gains access to a private network with the intent of finding out what information is stored on the network.

A packet sniffer also known as a packet analyzer, is a computer software or hardware tool that can be used to intercept, log and analyze network traffic and data that passes through a digital network.

Basically, an unauthorized packet sniffer is used to steal user informations.

This ultimately implies that, sniffing typically involves monitoring and capturing internet traffic (data packets) that are transmitted through a private network in real-time by using a sniffing tool, which may either be a hardware or software.

In this scenario, a malicious user in an airport terminal seating area was able to connect wirelessly to a traveling employee's smartphone and downloaded her contact list. Thus, the type of attack that has taken place is referred to as sniffing.

4 0
3 years ago
Other questions:
  • State three differences between a hard drive and a pen drive​
    6·1 answer
  • Question 12 (1 point)
    6·1 answer
  • It is important for security practitioners to take into consideration the __________ element when devising password security pol
    15·1 answer
  • Write a Python program segment, using a loop, to calculate and print the sum of the odd integers from 20 to 120. (Hint: 21 23 25
    13·1 answer
  • What is the largest place value in a 12 bit binary number?
    10·1 answer
  • Describe from an administrator perspective what is necessary to prepare a storage device for access by a user.
    14·1 answer
  • List 1 reason people invest in Cryptocurrency
    10·1 answer
  • Find examples of conic sections in art and architecture. Visit Web sites to find pictures of artwork or buildings that illustrat
    14·1 answer
  • Which THREE of the following actions can you perform with most webmail services?
    9·1 answer
  • Only the root user can modify a file that has the immutable attribute set.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!