1 / 60
文档名称:

哈工大C语言实验题.doc

格式:doc   大小:36KB   页数:60页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

哈工大C语言实验题.doc

上传人:282975922 2020/12/10 文件大小:36 KB

下载得到文件列表

哈工大C语言实验题.doc

相关文档

文档介绍

文档介绍:Q308. (10分)第2:体型判断。5章 实验“体指医务工作者经广泛的调查和统计分析,根据身高与体重因素给出了以下按 数”进行体型判断的方法。体指数计算公式是: t = w /(h*h)
是身高,其单位为米。根据给其中:t是体指数;w是体重,其单位为千克;h 定的体指数t计算公式,可判断你的体重属于何种类型: 时,为低体重; 当 t<18
时,为正常体重; 当 18≤t<25
时,为超重体重; 当 25≤t<27
时,为肥胖。 当 t≥27
Please enter h,w:\n
****输入提示信息格式:(先读入身高,再读入体重,身高以米读入,╜?春输入数据格式要求:**** 体重以千克读入):
****输出数据格式要求Lower weight!\n t<18 时,输出: 当Standard weight!\n t<25 时,输出: 当 18≤ 当 25≤t<27 时,输出:Higher weight!\n
当 t≥27 时, 输出:Too fat!\n
#include <>
#include <>

main()
{
float t,w,h;

printf(Please enter h,w:\n);

scanf(%f,%f,&h,&w);

t = w/(h*h);

if(t<18)
printf(Lower weight!\n);

else if(t>=18&&t<25)
printf(Standard weight!\n);

else if(t>=25&&t<27)
printf(Higher weight!\n);

else
printf(Too fat!\n);

return 0;
}
Q586.(
编写一个程序,输入年份和月份,判断该年是否是闰年,并根据给出的月分)10整除但不能被4份判断是什么季节和该月有多少天?(闰年的条件是年份能被月为秋3~5月为春季,6~8月为夏季,9~11整除;规定100整除,或者能被400 2月为冬季)。和12季,1、Please enter year,month:
提示信息:%d,%d **输入格式要求:%d is leap year\n %d is not leap year\n The season **输出格式要求:%d\n month this spring/summer/autumn/winter is is The number of days of
程序运行示例如下: :实例1Please enter year,month:2012,11
2012 is leap year
The season is autumn
The number of days of this month is 30
实例2:
Please enter year,month:2013,12
2013 is not leap year
The season is winter
The number of days of this month is 31
#include <>
#include <>

main()
{
int year=0,leap=0,mon=0,day=0;

printf(Please enter year,month:);
scanf(%d,%d,&year,&mon);

if((year_x0010_0!=0&&year%4==0)||(year_x0010_0==0&&******@0==0)){
printf(%d is leap year\n,year);
leap=1;
}
else
printf(%d is not leap year\n,year);

switch(mon)
{
case 1:
case 2:
ca