answer.
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
Liono4ka [1.6K]
2 years ago
13

Given sphereRadius and piVal, compute the volume of a sphere and assign to sphereVolume. Look up the equation online (e.g., http

://math.about.com/od/formulas/ss/surfaceareavol.htm). Use (4.0 / 3.0) to perform floating-point division, instead of (4 / 3) which performs integer division.
#include

int main(void) {
const double piVal = 3.14159;
double sphereVolume = 0.0;
double sphereRadius = 0.0;

sphereRadius = 1.0;

printf("Sphere volume: %lf\n", sphereVolume);

return 0;
Computers and Technology
1 answer:
fenix001 [56]2 years ago
6 0

Answer:

  1. #include <stdio.h>
  2. int main()
  3. {
  4.    const double piVal = 3.14159;
  5.    double sphereVolume = 0.0;
  6.    double sphereRadius = 0.0;
  7.    
  8.    sphereRadius = 1.0;
  9.    sphereVolume = 4.0/ 3.0 * piVal * sphereRadius * sphereRadius * sphereRadius;
  10.    
  11.    
  12.    printf("Sphere volume: %lf\n", sphereVolume);
  13.    return 0;
  14. }

Explanation:

Firstly we can identify the formula to calculate volume of sphere which is

Volume = 4/3 \pi r^{3}

With this formula in mind, we can apply this formula to calculate the volume of sphere in Line 10. This is important to perform floating-point division 4.0/3.0 to ensure the resulting value is a floating value as well. Since we have been given piVal and sphereRadius, we can just multiply the result of floating-point division with piVal and sphereRadius and get the sphereVolume value.

At last, display the sphere volume using printf method (Line 13).

You might be interested in
Write a function string middle(string str) that returns a string containing the middle character in str if the length of str is
Katen [24]

Answer:

function getMiddle(s) {

return s.length % 2 ? s.substr(s.length / 2, 1) : s.substr((s.length / 2) - 1, 2);

}

// I/O stuff

document.getElementById("submit").addEventListener("click", function() {

input = document.getElementById("input").value;

document.getElementById("output").innerHTML = getMiddle(input);

});

Explanation:

// >>> is an unsigned right shift bitwise operator. It's equivalent to division by 2, with truncation, as long as the length of the string does not exceed the size of an integer in Javascript.

// About the ~ operator, let's rather start with the expression n & 1. This will tell you whether an integer n is odd (it's similar to a logical and, but comparing all of the bits of two numbers). The expression returns 1 if an integer is odd. It returns 0 if an integer is even.

// If n & 1 is even, the expression returns 0.

// If n & 1 is odd, the expression returns 1.

// ~n & 1 inverts those two results, providing 0 if the length of the string is odd, and 1 if the length of the sting is even. The ~ operator inverts all of the bits in an integer, so 0 would become -1, 1 would become -2, and so on (the leading bit is always the sign).

// Then you add one, and you get 0+1 (1) characters if the length of the string is odd, or 1+1 (2) characters if the length of the string is even.

6 0
1 year ago
When a file is transferred between two computers, two acknowledgment strategies are possible. in the first one, the file is chop
ra1l [238]
The TCP/IP stack is responsible for the "chopping up" into packets of the data for transmission and for their acknowledgment. Depending on the transport protocol that is used (TCP or UDP) each packet will be <span>acknowledged or not, respectively.
</span><span>the strategy when the file is chopped up into packets, which are individually acknowledged by the receiver, but the file transfer as a whole is not acknowledged is OK in situations (Applications) that do not need the whole file to be sent, Web site for example: different parts of the web site can arrive in different times.

The other strategy, in which </span><span>the packets are not acknowledged individually, but the entire file is acknowledged when it arrives is suitable for FTP (mail transfer), we need whole mail, not parts of it. </span>
5 0
2 years ago
Lynn runs the locate command and the results include many files from a directory that she doesn't want to include in her search.
Zinaida [17]

Answer:

C) /etc/updatedb.conf

Explanation:

The locate command actually uses the configuration file located at /etc/updated.conf.

5 0
1 year ago
Read 2 more answers
First, open two separate terminal connections to the same machine, so that you can easily run something in one window and the ot
dusya [7]
Dnt listen to da file shi
7 0
2 years ago
Describe different types of intrusions such as SQL PL/SQL, XML, and other injections.
Finger [1]

<em>Intrusion means unauthorized and harmful activities happening in your system. Any irregularities in the system is considered as intrusion and therefore monitored by administrators and can be detected using Intrusion Detection System. </em>

<em>Examples of Intrusion attacks in a network are: </em>

  • <em>Denial of Service (Dos) - denial of service means flooding the system causing it to crash and unable to respond to a service request. Normally, a DoS attack is facilitated by numbers of hosts sending enormous request to a victim computer. The requests can be in a form of code that would flood the system and making it to unresponsive.  </em>
  • <em>Man in the Middle Attack (MiM) - a hacker would be in the middle of the communication between a client computer and a server computer. The hacker can mimic IPs within the network and steal information then sends it to the intended receiver.  </em>
  • <em>SQL Injection - For websites that runs database like SQL, a code by the hacker can be added to the website and making him gained access to the database information successfully.</em>
8 0
2 years ago
Other questions:
  • What advantage do ExpressCard modules and USB adapters offer over expansion cards?
    5·1 answer
  • A ____ partition contains the data necessary to restore a hard drive back to its state at the time the computer was purchased an
    8·2 answers
  • python Consider this data sequence: "3 11 5 5 5 2 4 6 6 7 3 -8". Any value that is the same as the immediately preceding value i
    7·1 answer
  • ______ is a statistic that measures how quickly the staff corrected a network problem after they arrived at the problem site. MT
    9·1 answer
  • Which of these words could byte pair encoding compress the most?
    13·1 answer
  • In defining security implemention, what are the roles of the following committees. 1) gateway committee 2) project committee 3)
    8·1 answer
  • Suppose a host has a 1-MB file that is to be sent to another host. The file takes 1 second of CPU time to compress 50%, or 2 sec
    12·1 answer
  • Write a fragment of code that reads in strings from standard input, until end-of-file and prints to standard output the largest
    10·1 answer
  • Earlier in the day, you created a user account for Brenda Cassini (bcassini). When she tries to log in, she can't. You realize t
    9·2 answers
  • 1.1.5 practice: analyzing business culture
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!