Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
19
Task/Temperature-conversion/AWK/temperature-conversion-2.awk
Normal file
19
Task/Temperature-conversion/AWK/temperature-conversion-2.awk
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# usage: gawk -f temperature_conversion.awk input.txt -
|
||||
|
||||
BEGIN { print("# Temperature conversion\n") }
|
||||
BEGINFILE { print "# reading", FILENAME
|
||||
if( FILENAME=="-" ) print "# Please enter temperature values in K:\n"
|
||||
}
|
||||
|
||||
!NF { exit }
|
||||
|
||||
{ print "Input:" $0 }
|
||||
$1<0 { print("K must be >= 0\n"); next }
|
||||
{ K = 0+$1
|
||||
printf("K = %8.2f Kelvin degrees\n",K)
|
||||
printf("C = %8.2f\n", K - 273.15)
|
||||
printf("F = %8.2f\n", K * 1.8 - 459.67)
|
||||
printf("R = %8.2f\n\n",K * 1.8)
|
||||
}
|
||||
|
||||
END { print("# Bye.") }
|
||||
Loading…
Add table
Add a link
Reference in a new issue