Skip to main content
Commonmark migration
Source Link

#AWK — 84 78 characters

AWK — 84 78 characters

awk '{printf"The hypotenuse of this right triangle is %.3f\n",($1^2+$2^2)^.5}'

Thanks to Wasi for suggesting ^ operator and removing ()!

e.g.

$ echo 3 4 | awk '{printf"The hypotenuse of this right triangle is %.3f\n",($1^2+$2^2)^.5}'
The hypotenuse of this right triangle is 5.000

#AWK — 84 78 characters

awk '{printf"The hypotenuse of this right triangle is %.3f\n",($1^2+$2^2)^.5}'

Thanks to Wasi for suggesting ^ operator and removing ()!

e.g.

$ echo 3 4 | awk '{printf"The hypotenuse of this right triangle is %.3f\n",($1^2+$2^2)^.5}'
The hypotenuse of this right triangle is 5.000

AWK — 84 78 characters

awk '{printf"The hypotenuse of this right triangle is %.3f\n",($1^2+$2^2)^.5}'

Thanks to Wasi for suggesting ^ operator and removing ()!

e.g.

$ echo 3 4 | awk '{printf"The hypotenuse of this right triangle is %.3f\n",($1^2+$2^2)^.5}'
The hypotenuse of this right triangle is 5.000
Using ^ operator and removing ().
Source Link
user15259
user15259

#AWK — 8484 78 characters

awk '{printf("Theprintf"The hypotenuse of this right triangle is %.3f\n",sqrt($1*$1+$2*$2)$1^2+$2^2)^.5}'

Thanks to Wasi for suggesting ^ operator and removing ()!

e.g.

$ echo 3 4 | awk '{printf("Theprintf"The hypotenuse of this right triangle is %.3f\n",sqrt($1*$1+$2*$2)$1^2+$2^2)^.5}'
The hypotenuse of this right triangle is 5.000

#AWK — 84 characters

awk '{printf("The hypotenuse of this right triangle is %.3f\n",sqrt($1*$1+$2*$2))}'

e.g.

$ echo 3 4 | awk '{printf("The hypotenuse of this right triangle is %.3f\n",sqrt($1*$1+$2*$2))}'
The hypotenuse of this right triangle is 5.000

#AWK — 84 78 characters

awk '{printf"The hypotenuse of this right triangle is %.3f\n",($1^2+$2^2)^.5}'

Thanks to Wasi for suggesting ^ operator and removing ()!

e.g.

$ echo 3 4 | awk '{printf"The hypotenuse of this right triangle is %.3f\n",($1^2+$2^2)^.5}'
The hypotenuse of this right triangle is 5.000
Source Link
user15259
user15259

#AWK — 84 characters

awk '{printf("The hypotenuse of this right triangle is %.3f\n",sqrt($1*$1+$2*$2))}'

e.g.

$ echo 3 4 | awk '{printf("The hypotenuse of this right triangle is %.3f\n",sqrt($1*$1+$2*$2))}'
The hypotenuse of this right triangle is 5.000