帮助完成楼层计划 [英] help with a floor program

查看:68
本文介绍了帮助完成楼层计划的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个问题..

函数floor的应用程序ia将值舍入到最接近的整数。陈述y = floor(x + 0.5);将数字x舍入为最接近的整数,并将结果赋给y。我们如何编写一个读取多个数字的程序,并使用前面的语句将每个数字四舍五入到最接近的整数。对于每个进行的数字,打印原始数字和四舍五入的数字。

hi
i have a question..
An application of function floor ia rounding a value to the nearest integer. the statement y=floor(x+0.5); rounds the number x to the nearest integer and assigns the result to y. how can we write a program that reads several numbers and uses the preceeding statement to round each of these numbers to the nearest integer. for each number proceeded, print both the original number and the rounded number.

推荐答案

你的问题是......?
And your question is...?


我们如何编写一个读取多个数字的程序并使用前面的语句将每个数字四舍五入到最接近的整数?
how can we write a program that reads several numbers and uses the preceeding statement to round each of these numbers to the nearest integer?



我们如何编写一个读取多个数字的程序并使用前面的语句将每个数字四舍五入到最接近的整数?
how can we write a program that reads several numbers and uses the preceeding statement to round each of these numbers to the nearest integer?



你可以有一个循环从键盘读取x的值,用y = floor(x + 0.5)计算y;并打印x和y

you could have a loop which reads the value of x from the keyboard, calculates y using y=floor(x+0.5); and prints x and y


这篇关于帮助完成楼层计划的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆