《明解C语言》第一章笔记及练习题

笔记:
输出函数:
1、printf
输出字符串可以含有多个实参。
2、puts
只能输出字符串
3、putchat
只能输出ACSII码
练习题
1-1

include

void main()
{
int a = 15 , b = 37;
int c = a - b;
printf("%d-%d的结果是%d \n",a,b,c);
}
1-2

include

void main()
{
printf("天\n地\n人\n");
}
1-3

include

void main()
{
printf("喂!\n\n您好!\n再见.\n");
}
1-4

1-5

include

void main()
{
int a;
printf("请输入一个整数:");scanf("%d",&a);
printf("该整数加上12的结果是:%d\n",a+12);
}
1-6

include

void main()
{
int a;
printf("请输入一个整数:");scanf("%d",&a);
printf("该整数减去6的结果是:%d\n",a-6);
}
1-7

include

void main()
{
puts("天\n地\n人");
}
1-8

include

void main()
{
int a,b;
printf("第一个整数:"); scanf("%d",&a);
printf("第二个整数:"); scanf("%d",&b);
printf("他们的乘积是%d\n",a*b);
}
1-9

include

void main()
{
int a,b,c;
printf("第一个整数:"); scanf("%d",&a);
printf("第二个整数:"); scanf("%d",&b);
printf("第三个整数:"); scanf("%d",&c);
printf("他们的和是:%d\n",a+b+c);
}

你可能感兴趣的:(《明解C语言》第一章笔记及练习题)