自由落体的题 (用C#来做)

来源:百度知道 编辑:UC知道 时间:2024/05/24 11:36:14
一个球从100米高度自由落下,每次落地后反跳回原来高度的一半再落下,求它在第10次落地时共经过多少米?第10次反弹多高?
谢谢大家越快越好给我回复

using System;
using System.Collections.Generic;
using System.Threading;
using System.Text;

namespace Application1
{
class Program
{
static void Main(string[] args)
{
double h =100;
double S = h;
for (int i = 0; i < 10; i++)
{
h = h / 2;
S = h + S;

}
Console.WriteLine(\"10次一共经过了{0}\",S);
Console.WriteLine(\"10次之后的高度 {0}\",h);

}
}
}