Java calculated the problem of the ball falling freely from a height of 100 meters

  • 2020-06-12 09:02:44
  • OfStack

1. The ball falls freely from a height of 100 meters and bounces back to its original height after each landing. And then on the tenth landing, how many meters did it go? How high was the 10th rebound?


public class Ex10 {
 public static void main(String[] args)
 {
   double s=0;
   double t=100;
   for(int i=1;i<=10;i++)
   {
     s+=t;
     t=t/2;
   }
   System.out.println(s);
   System.out.println(t);
   
 }
}


Related articles: