Answer to Question #260808 in C for koushik

Question #260808

In a box of total area 10000cm3, Mr. Varun has to pack the balls of given radius “r” and all the balls have the same volume, Help Mr. Varun to find the total number of balls that he can pack in the given box.

 

 Requirements

 Capture the radius of the ball “r”

 Compute the volume (Hint: Volume=4/3πr3)

 Calculate how many number of balls can be placed in the box of 10000cm3 box  Display the number of balls packed by Mr. Varun 



1
Expert's answer
2021-11-03T17:30:44-0400
#include <stdio.h>


int main()
{
    double boxVolume = 10000;
    double ballRadius;
    printf("radius of the ball = ");
    scanf("%lf", &ballRadius);
    printf("\n");


    double ballVolume = 4*3.14*ballRadius*ballRadius*ballRadius;
    int balls = (int)(boxVolume/ballVolume);
    printf("balls: %d", balls);


    printf("\n\n");
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS