[dywang@deyu zzz]$ vim fstdio3.c
[dywang@deyu zzz]$ cat fstdio3.c
#include <stdio.h>
int main() {
int a, b;
printf("Enter TWO integers:\n");
scanf("%d %d", &a, &b);
printf("%d * %d = %d\n", a, b, a*b);
}
[dywang@deyu zzz]$ gcc -o fstdio3 fstdio3.c
[dywang@deyu zzz]$ ./fstdio3 Enter TWO integers: 12 -9 12 * -9 = -108
& 運算子會有什麼結果?
scanf("%d %d", a, b);
[dywang@deyu zzz]$ vim fstdio4.c
[dywang@deyu zzz]$ cat fstdio4.c
#include <stdio.h>
int main() {
float a, b;
printf("Input TWO floats: %%f %%e\n");
scanf("%f %e", &a, &b);
printf("%f * %e = %e\n", a, b, a*b);
}
[dywang@deyu zzz]$ gcc -o fstdio4 fstdio4.c
[dywang@deyu zzz]$ ./fstdio4 Input TWO floats: %f %e 3.2345 1.28e3 3.234500 * 1.280000e+03 = 4.140160e+03
scanf("%f %e", a, b);