When we drop a ball on a rigid surface it bounces from the surface upto a height which can be expressed as some percentage of its previous height. This percentage is based on something known as coefficient of restitution. This coefficient is different for different types of balls. For example if the coefficient is 0.9 it means that the ball will go up to 90 percent of its previous height after each bounce.Ã?Â Ã?Â So if a ball withÃ?Â Ã?Â coefficient=0.9 is dropped initially from aÃ?Â Ã?Â height of 10 meters, after 1 bounce the height will be 9 meters, after 2 bounces it will be 8.1 meters and so on.Ã?Â Ã?Â The total distance the ball has traveled after one bounce is 10 + 9 = 19 meters, after two bounces the total distance is 10 + 9 + 9 + 8.1 = 36.1
Write a program in C that where the user will input an initial height(in metres) and also the coefficient of restitution r (the value of r will be between 0 and 1). Declare an array HEIGHT for storing the height of the ball after each bounce. HEIGHT will contain the original height from which the ball is dropped. HEIGHT to HEIGHT will contain the height after each of the bounces. Your program should display the original height and then followed by the number of each bounce and the height of that bounce. You should stop either when the height of the ball is less than 1 cm (=0.01 meter) or until 100 bounces are completed. Your program should also compute and display the total distance the ball has traveled till the end.