运行结果:
C程序代码:
/* c how to program 习题3.19 */
#include <stdio.h>
#include <stdlib.h>
int main()
{
//分别定义变量
double interest, principal, rate;
int days;
//获取第一次的贷款金额
...
运行结果:
C语言代码:
/* c how to program 习题 3.17 */
#include <stdio.h>
#include <stdlib.h>
int main()
{
//定义变量
int accountNumber;
double beginningBalance, totalCharges, totalCredits, credi ...
运行结果:
C语言代码:
/* c how to program 习题3.16 */
#include <stdio.h>
#include <stdlib.h>
int main()
{
//分别定义变量:燃油量,里程数,总的燃油量,总的里程数,油耗比,平均油耗比
float gallon, mile ...
//c how to program 习题2.31
#include <stdio.h>
int main( void )
{
int number = 0;
printf("number\tsqure\tcube\n");
printf("%d\t%d\t%d\n", number, number*number, number*number*number);
number = number+1;
printf("%d\t%d\t%d\n", number, nu ...
//c how to program 习题2.30
#include <stdio.h>
int main( void )
{
printf("请输入一个5位的整数:");
int number, temp;
scanf("%d", &number);
int a, b, c, d, e;
temp = number;
a = temp / 10000;
temp = number % 10000;
b = temp / 1000 ...
//c how to program 习题2.26
#include <stdio.h>
int main(void)
{
int x, y;
printf("请输入两个整数:");
scanf("%d%d", &x, &y);
if(x%y == 0){
printf("%d是%d的倍数\n", x, y);
printf("%d是%d的%d倍\n", x, y, x / y);
}
if(x%y != 0 ...