lesson 6 showmath c
[[lesson_6_showmath_c]] last edit on
Aug 9, 2005
2:13 AM
by rescued_by_c
[user02@FC4 Lesson06]$ cat -n showmath.c
[user02@FC4 Lesson06]$ ./showmath
5 + 7 = 12
12 - 7 = 5
1.2345 * 2 = 2.469000
15 / 3 = 5
1 #include <stdio.h>
2
3 int main(void)
4 {
5 printf("5 + 7 = %d\n", 5 + 7);
6 printf("12 - 7 = %d\n", 12 - 7);
7 printf("1.2345 * 2 = %f\n", 1.2345 * 2);
8 printf("15 / 3 = %d\n", 15 / 3);
9
10 return 0;
11 }
[user02@FC4 Lesson06]$ gcc -o showmath showmath.c[user02@FC4 Lesson06]$ ./showmath
5 + 7 = 12
12 - 7 = 5
1.2345 * 2 = 2.469000
15 / 3 = 5