析
基本整型 ——“%d”
长整型 ——“%ld”
单精度实型——“%f”
双精度实型——“%lf”
字符型 ——“%c”
P8
动 手 练 习
1-2
编写程序,计算边长为150的正方形面 积和183的值,并按如下形式显示。
========== Welcome ========== The area is 22500 The third power of 18 is 5832.000000 ========== Good-bye ==========
编辑程序
#include <stdio.h>
+、-、*、/、%
#include <math.h> main()
算术运算符
{ printf("125+65=%d\n",125+65);
printf("%d+%d=%d\n",
125,65,125+65);
printf("square root of 130:%lf\n",
问
在C语言中要将一批信息告诉 用户或给用户显示如下图案,就
P2
题 用第一种格式的printf函数。
的
提
出
1.1.1用printf函数控制输出一串字符
P2
任
【实例1-1】编写程序,在屏幕 上显示如下问候语。
务
与
<-----C Programming----->
<
>
分
< How do you do? >
析
<
>
< Nice to meet you! >