c语言习题及答案-爱课程mooc 下载本文

内容发布更新时间 : 2024/5/20 20:39:55星期一 下面是文章的全部内容请认真阅读。

第一章

1.1

题目内容:

使用printf()在屏幕上输出 hello world!

提示:

#include int main() { printf(\ return 0;

}

输入格式:

输出格式:

输出提示信息:\

输入样例:

输出样例:

hello world!

#include int main() { printf(\ return 0; }

1.2

在屏幕上输出多行信息(3分)

题目内容:

使用printf()函数在屏幕上输出以下多行信息: hello world!

精选

hello hit! hello everyone! 提示:

在printf()函数中转义字符‘\\n’表示换行。

输入格式:

输出格式: 输出提示信息: \\\输入样例:

输出样例: hello world! hello hit! hello everyone!

#include int main() {

printf(\ printf(\

printf(\ return 0; }

1.3

计算半圆弧的周长及半圆面积(3分)

题目内容:

编程并输出半径r=5.3的半圆弧的周长及该半圆的面积,

输入格式: 无

输出格式:

半圆的面积输出格式: \

半圆弧的周长输出格式: \输入样例:

精选

的取值为3.14159。要求半径r和

必须利用宏常量表示。

输出样例: Area=44.123632

circumference=16.650427

#include #define PI 3.14159 #define R 5.3 int main() {

printf(\

printf(\ return 0; }

1.4

计算长方体体积(3分)

题目内容:

编程并输出长1.2、宽4.3、高6.4的长方体的体积。要求长方体的长、宽、高必须利用const常量表示。

输入格式: 无

输出格式:

长方体的体积输出格式:\

输入样例:

输出样例:

#include int main() {

const float l=1.2; const float x=4.3; const float y=6.4;

printf(\ return 0; }

精选