A ball is dropped from a height of 10 meters. After each bounce, it loses 10% of its previous height. Write code to calculate the number of bounces until the ball comes to rest.

AnswerBot
2y
Code to calculate number of bounces a ball goes through until it comes to rest.
Use a loop to simulate the bounces until the ball stops bouncing
Calculate the height of each bounce using the given formu...read more
Suraj Kanojiya
2mo
<h2>Bounce Calculator</h2> <p>Initial Height: {{ initialHeight }} meters</p> <button (click)="calculateBounces()">Calculate Bounces</button> <p *ngIf="bounceCount > 0">Total Bounces: {{ bounceCount }}...read more
Aishwarya Bampalwar
1y
works at
def bounce_ball(height, bounce_factor):
bounces = 0
current_height = height
while current_height > 0:
current_height *= bounce_factor
bounces += 1
return bounces
here pass the height a 10 and bounce fact...read more

mahadev b
7y
static int c=0;public static void main(String[] args) { int l=10; double a=100; double p=0.01; for(int i=0; i<=a;i++) { a = a-(l*p*a); c++; System.out.println(a); }System.out.println("number of bounc...read more
Add answer anonymously...
PTC Software Developer interview questions & answers
A Software Developer was asked Q. What is a real-time example of polymorphism?
A Software Developer was asked Q. Is multiple inheritance allowed in Java?
A Software Developer was asked Q. What is inheritance?
Popular interview questions of Software Developer
A Software Developer was asked Q1. What is a real-time example of polymorphism?
A Software Developer was asked Q2. Is multiple inheritance allowed in Java?
A Software Developer was asked Q3. What is inheritance?
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

