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

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(\

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4