Answer to Question #259596 in C for fas

Question #259596

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:31:15-0400
#include <stdio.h>
#include <stdlib.h>


int main()
{
	const float PI=3.14159265359;
	int totalNumberBalls=-1;
	float r;
	float volume;
	//Capture the radius of the ball r
	printf("Enter the radius of the ball: ");
	scanf("%f",&r);
	//Compute the volume (Hint: Volume=4/3pir3)
	volume=(4.0/3.0)*PI*r*r*r;
	//Calculate how many number of balls can be placed in the box of 10000cm3 box
	totalNumberBalls=10000.0/volume;
	//Display the number of balls packed by Mr. Varun
	printf("The total number of balls that can be packed in the given box = %d\n\n",totalNumberBalls);
	
	getchar();
	getchar();
	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

koushik
03.11.21, 16:55

nice

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS