c how to program 习题4.21

c how to program 习题4.21

运行结果: C语言代码: //C how to program 习题4.20 //按要求修改4.2的循环程序 #include<stdio.h> int main(void){ //initialization, iteration condition, and increment //are all included in the for statement head ...

c how to program 习题4.19

c how to program 习题4.19

运行结果: C语言代码: //C how to program 习题4.19 //功能:计算零售额 #include<stdio.h> int main(void){ //打印产品零售价 printf("%s", "产品编号\t\t零售价\n"); printf("%5d\t\t\t$%.2f\n", 1, 2.98); pri ...

c how to program 习题4.18

c how to program 习题4.18

运行结果: C语言代码: //C how to program 习题4.18 //功能:打印柱状图 #include<stdio.h> int main(void){ printf("请输入5个1-30的整数:"); //循环5次,打印5个图案 for(int i=0; i<5; i++){ //定义变量 ...

c how to program 习题4.17

c how to program 习题4.17

运行结果: C语言代码: //C how to program 习题4.17 //功能:计算信贷限额 #include<stdio.h> int main(void){ //定义变量 int account; double limit, balance, newLimit; //循环三次,计算三个用户 for(int ...

c how to program 习题16

c how to program 习题16

运行结果: C语言代码: /* c how to program 习题4.16 ** 打印三角形 */ #include <stdio.h> #include <math.h> // function main begins program execution int main( void ) { //定义x为*,y为换行,z为空格 int x, y, z; ...

c how to program 习题4.15

c how to program 习题4.15

运行结果: C语言代码: /* c how to program 习题4.15 ** 计算利息 */ #include <stdio.h> #include <math.h> // function main begins program execution int main( void ) { //定义principal为本金,rate为利率 double ...

c how to program 习题4.14

c how to program 习题4.14

运行结果: C语言代码: /* c how to program 习题4.14 ** 计算1-5的阶乖 */ #include <stdio.h> #include <math.h> // function main begins program execution int main( void ) { //定义变量x为整数,n为阶乘 int x, n ...

c how to program 习题4.13

c how to program 习题4.13

运行结果: C语言代码: /* c how to program 习题4.13 ** 计算1-15的奇数积 */ #include <stdio.h> #include <math.h> // function main begins program execution int main( void ) { //定义变量number为奇数,total为乘积 ...

c how to program 习题4.12

c how to program 习题4.12

运行结果: C语言代码: /* c how to program 习题4.12 ** 计算2-30的偶数和 */ #include <stdio.h> #include <math.h> // function main begins program execution int main( void ) { //定义变量number为偶数,total为累加 ...

c how to program 习题4.11

c how to program 习题4.11

运行结果: C语言代码: /* c how to program 习题4.11 */ #include <stdio.h> #include <math.h> // function main begins program execution int main( void ) { //定义变量value为输入的整数,number为整数的个数,count为 ...