下载此文档

c语言习题及答案 爱课程mooc.doc


文档分类:IT计算机 | 页数:约16页 举报非法文档有奖
1/16
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/16 下载此文档
文档列表 文档介绍
c 语言****题及答案爱课程 mooc 第一章 题目内容: 使用 printf() 在屏幕上输出 hello world! 提示: #include <> int main() {} printf("hello world!\n"); return 0; 输入格式:无输出格式: 输出提示信息: "hello world!\n" 输入样例: 输出样例: hello world! #include <> int main() { printf("hell o world!\n"); return 0;} 在屏幕上输出多行信息( 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 <> int main() { printf("hello world!\n"); printf("hello hit!\n"); printf("hello everyone!\n"); return 0;} 计算半圆弧的周长及半圆面积( 3 分) 题目内容: 编程并输出半径 r= 的半圆弧的周长及该半圆的面积, 输入格式:无输出格式: 半圆的面积输出格式: "Area=%f\n" 半圆弧的周长输出格式: "circumference=%f\n" 输入样例: 输出样例: Area= 的取值为 。要求半径 r 和必须利用宏常量表示。 circumference= #include<> #define PI #define R int main() { printf("Area=%f\n", R*R*PI/2); printf("circumference=%f\n", 2*R*PI/2); return 0;} 计算长方体体积( 3 分) 题目内容: 编程并输出长 、宽 、高 的长方体的体积。要求长方体的长、宽、高必须利用 const 常量表示。输入格式:无输出格式: 长方体的体积输出格式: "volume=%.3f\n" 输入样例: 输出样例: #include<> int main() { const float l=; const float x=; const float y=; printf("volume=%.3f\n", l*x*y); return 0;} 第三章 计算两个数的平方和( 3 分) 题目内容: 从键盘读入两个实数, 编程计算并输出它们的平方和, 要求使用数学函数 pow(x,y) 计算平方值, 输出结果保留 2 位小数。提示: 使用数学函数需要在程序中加入编译预处理命令#include <> 以下为程序的输出示例: please input x and y: , ↙ result= 输入格式: "%f,%f" 输出格式: 输入提示信息: "please input x and y:\n" 输出格式: "result=%.2f\n" 输入样例: 输出样例: #include<> #include<> 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 分) 题目内容: 从键盘输入一个 4 位数的整数, 编程计算并输出它的逆序数( 忽略整数前的正负号) 。例如,输入-1234 ,忽略负号,由 1234 分离出其千位 1、百位 2、十位 3、个位 4, 然后计算 4*1000+3*100+2*10+1 = 4321 , 并输出 4321 。再将得到的逆序数 4321 拆分为两个 2 位数的正整数 43和 21, 计算并输出拆分后的两个数的平方和的结果。以下是

c语言习题及答案 爱课程mooc 来自淘豆网www.taodocs.com转载请标明出处.

非法内容举报中心
文档信息
  • 页数16
  • 收藏数0 收藏
  • 顶次数0
  • 上传人wz_198614
  • 文件大小20 KB
  • 时间2017-05-28