lesson 12 sqrt c
[[lesson_12_sqrt_c]] last edit on
Aug 18, 2005
7:08 AM
by rescued_by_c
[user02@FC4 Lesson12]$ cat -n sqrt.c
[user02@FC4 Lesson12]$ ./sqrt
The square root of 100.0 is 10.000000
The square root of 10.0 is 3.162278
The square root of 5. 0 is 2.236068
[user02@FC4 Lesson12]$
1 #include <stdio.h>
2 #include <math.h> // Contains sqrt prototype
3
4 int main(void)
5 {
6 printf("The square root of 100.0 is %f\n", sqrt(100.0));
7 printf("The square root of 10.0 is %f\n", sqrt(10.0));
8 printf("The square root of 5. 0 is %f\n", sqrt(5.0));
9
10 return 0;
11 }
[user02@FC4 Lesson12]$ gcc -o sqrt sqrt.c[user02@FC4 Lesson12]$ ./sqrt
The square root of 100.0 is 10.000000
The square root of 10.0 is 3.162278
The square root of 5. 0 is 2.236068
[user02@FC4 Lesson12]$