C语言实验习题指导书答案(第二版) 下载本文

内容发布更新时间 : 2024/11/14 13:56:27星期一 下面是文章的全部内容请认真阅读。

P27 (2): #include #include int main(void) {

int year;

double interest,money,rate;

printf(\

scanf(\

interest=money*pow((1.0+rate),year)-money;

printf(\

return 0; }

P28 (3):

#include #include int main(void) {

double x; double y;

printf(\ scanf(\

if(x<0){

y=pow(x+1,2)+2*x+1/x; } else{

y=sqrt(x); }

printf(\

return 0; }

P28 (4):

#include

#include int main(void) {

int num1,num2;

printf(\ scanf(\ printf(\ scanf(\

printf(\ printf(\ printf(\ printf(\

printf(\

return 0; }

思考:

#include #include int main(void) {

double num1,num2; printf(\ scanf(\ printf(\ scanf(\

printf(\ printf(\ printf(\ printf(\

// printf(\

return 0;

} (其中最后一句不能执行!)

P28 (5): P28(6):

P34 (1):

#include int main(void)

{

int m,sum;

printf(\ scanf(\

sum=0;

for(m;m<=100;m++) {

sum=sum+m; }

printf(\

return 0; }

思考:

#include int main(void) {

int m,n,sum;

printf(\ scanf(\ printf(\ scanf(\

sum=0;

for(m;m<=n;m++) {

sum=sum+m; }

printf(\

return 0; }

P34 (2):

#include int main(void) {

int m,n;

double item,sum;

printf(\ scanf(\