- 1、本文档共50页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
第一章
1.1 题目内容:
使用 printf() 在屏幕上输出 hello world!
提示:
#include stdio.h
int main()
{
printf(hello world!\n);
return 0;
}
输入格式 :
无
输出格式:
输出提示信息: hello world!\n
输入样例:
输出样例:
hello world!
#include stdio.h
int main()
{
printf(hello world!\n);
return 0;
}
1.2
在屏幕上输出多行信息( 3 分)
题目内容:
使用 printf() 函数在屏幕上输出以下多行信息:
hello world!
hello hit!
hello everyone!
提示:
在 printf() 函数中转义字符 , n?表示换行。
输入格式 :
输出格式:
输出提示信息:
hello world!\n
hello hit!\n
hello everyone!\n
输入样例:
输出样例:
hello world!
hello hit!
hello everyone!
#include stdio.h
int main()
{
printf(hello world!\n);
printf(hello hit!\n);
printf(hello everyone!\n);
return 0;
}
1.3
计算半圆弧的周长及半圆面积( 3 分)
题目内容:
编程并输出半径 r=5.3 的 半圆弧的周长 及该 半圆的面积 , 的取值为 3.14159 。要求半径 r 和 必须利用 宏常量 表示。
输入格式 :
无
输出格式:
半圆的面积输出格式: Area=%f\n
半圆弧的周长输出格式: circumference=%f\n
输入样例:
输出样例:
Area=44.123632
circumference=16.650427
#includestdio.h
#define PI 3.14159
#define R 5.3
int main()
{
printf(Area=%f\n, R*R*PI/2);
printf(circumference=%f\n, 2*R*PI/2);
return 0;
}
1.4
计算长方体体积( 3 分)
题目内容:
编程并输出长 1.2、宽 4.3、高 6.4 的长方体的体积。要求长方体的长、宽、高必须利用 const 常量 表示。
输入格式 :
无
输出格式:
长方体的体积输出格式: volume=%.3f\n
输入样例:
输出样例:
#includestdio.h
int main()
{
const float l=1.2;
const float x=4.3;
const float y=6.4;
printf(volume=%.3f\n, l*x*y);
return 0;
}
第三章
3.1
计算两个数的平方和( 3 分)
题目内容:
从 键盘 读入两个实数,编程计算并输出它们的 平方和 ,要求使用数学函数 pow(x,y) 计算平方值,输出结果保留 2 位小数。
提示:使用数学函数需要在程序中加入编译预处理命令 #include math.h
以下为程序的输出示例:
please input x and y:
1.2,3.4 ↙
result=13.00
输入格式 :
%f,%f
输出格式:
输入提示信息: please input x and y:\n
输出格式: result=%.2f\n
输入样例:
输出样例:
#includestdio.h
#includemath.h
int main()
{
printf(please input x and y:\n);
float x, y;
scanf(%f,%f, x, y);
printf(result=%.2f\n, pow(x,2)+pow(y,2));
return 0;
}
3.2 逆序数的拆分计算( 3 分)
题目内容:
从键盘输入一个 4 位 数的 整数 ,编程计算并输出它的 逆序数 (忽略 整数前的 正负号 )。例如,输入 -1234 ,忽略负号,由 1234 分离出
其千位 1、百位 2、十位 3、个位 4,然后计算 4*1000+3*100+2*10+1 = 4321 ,并输出 4321 。再将得到的逆序数 4321 拆分为 两个 2
位数 的正整数 43 和 21,计算并输出拆分后的两个数的 平方和 的结果。
以下是程序的输出示例:
Input x:
-1234 ↙
y=4321
a=43,b=21
result=2290
输入格式 :
%d
输出格式:
输入提示信息: Input x:\n
逆序数输出格式:
您可能关注的文档
- 《面向对象程序设计》习题.docx
- 2011年本科二批录取院校录取最低分数线.docx
- 2011年广东高考分数线以与分数段统计表.docx
- 2016突发事件应急习题与答案.docx
- 2020年度人工智能与健康试题与答案合集.docx
- 2020年宜宾人工智能与健康答案.docx
- androidUI说明和开发实例.docx
- CAD技能大赛总结书.docx
- CI快速开发商城-20130829.docx
- C语言编程习题.docx
- 四川省德阳市罗江中学2025届高三考前热身化学试卷含解析.doc
- 山东省枣庄现代实验学校2025届高三下学期第五次调研考试化学试题含解析.doc
- 吉林省长春市十一高中等九校教育联盟2025届高三一诊考试生物试卷含解析.doc
- 2025届江苏省盐城市伍佑中学高考仿真模拟化学试卷含解析.doc
- 2025届广西贺州中学高考冲刺押题(最后一卷)生物试卷含解析.doc
- 安徽省池州市贵池区2025届高三第一次模拟考试生物试卷含解析.doc
- 宁夏银川一中2025届高三(最后冲刺)化学试卷含解析.doc
- 广东省广州市增城区四校联考2025届高考压轴卷化学试卷含解析.doc
- 2025届邯郸市第一中学高考生物必刷试卷含解析.doc
- 2025届安徽省安庆市石化第一中学高考仿真卷化学试卷含解析.doc
文档评论(0)