Java classic algorithm _ 010 a ball is freely dropped from the height of 100 meters. After each landing, it jumps back to half of the original height.

Source: Internet
Author: User

Question: How many meters does a ball fall from the height of 100 meters to half of the original height after each arrival? How high is the rebound of 10th times?

Package COM. arithmetic;/*** title: A ball falls freely from the height of 100 meters. After each landing, the ball jumps back to half of the original height. Then, when the ball falls back to the ground for 10th times, how many meters are there? How high is the rebound of 10th times? ** @ Author administrator **/public class test_wzs10 {public static void main (string [] ARGs) {int Total = 0; int Height = 100; for (INT I = 0; I <10; I ++) {system. out. print ("no." + (I + 1) + "height when dropping:" + height + ""); Total = total + height; Height = height/2; system. out. println ("no." + (I + 1) + "dropped after distance:" + total );}}}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.