首页 > 其他 > 详细

PTA|基础编程题目集|7-1

时间:2020-09-30 20:07:57      阅读:62      评论:0      收藏:0      [点我收藏+]

参考代码

 #include "cstdio"

int main(int argc, char const *argv[])
{
	/*
	(foot+inch/12)*0.3048 m    */
	int Len;//cm
	int foot,inch;
	scanf("%d",&Len);

	foot=int(Len/100.0/0.3048); 			//foot
	inch=int((Len/100.0/0.3048-foot*1.0)*12);//inch

	printf("%d %d\n",foot,inch);
	return 0;
}

解题

  • 单位换算
  • 同类型数据计算
  • 取整

PTA|基础编程题目集|7-1

原文:https://www.cnblogs.com/reaptem/p/13755946.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!