C 练习实例20 - 小球自由下落
C 语言教程
· 2019-02-21 16:56:29
题目:一球从100米高度自由落下,每次落地后反跳回原高度的一半;再落下,求它在第10次落地时,共经过多少米?第10次反弹多高?
程序分析:见下面注释。
程序源代码:
实例
// Created by www.codercto.com on 15/11/9.
// Copyright © 2015年 码农教程. All rights reserved.
//
#include<stdio.h>
int main()
{
float h,s;
h=s=100;
h=h/2; //第一次反弹高度
for(int i=2;i<=10;i++)
{
s=s+2*h;
h=h/2;
}
printf("第10次落地时,共经过%f米,第10次反弹高%f米\n",s,h);
return 0;
}
以上实例输出结果为:
第10次落地时,共经过299.609375米,第10次反弹高0.097656米
点击查看所有 C 语言教程 文章: https://codercto.com/courses/l/17.html
Trading and Exchanges
Larry Harris / Oxford University Press, USA / 2002-10-24 / USD 95.00
This book is about trading, the people who trade securities and contracts, the marketplaces where they trade, and the rules that govern it. Readers will learn about investors, brokers, dealers, arbit......一起来看看 《Trading and Exchanges》 这本书的介绍吧!