Mögliche Lösungen
zu 1)
BEGIN {
print "x\t|\ty"
print "---------------------------"
OFS="\t|\t"
for(x=0.0; x<=20.0; x+=0.2) {
print x, x^2
}
}
zu 2)
BEGIN {
print "x\t|\ty"
print "---------------------------"
OFS="\t|\t"
x = 0.0
while(x <= 20.0) {
print x, x^2
x += 0.2
}
}
zu 3)
BEGIN {
print "x\t|\ty"
print "---------------------------"
OFS="\t|\t"
x = 0.0
do {
print x, x^2
x += 0.2
} while(x <= 20.0)
}
Ausgabe jeweils:
x | y ----------------------------- 0 | 0 0,2 | 0,04 0,4 | 0,16 0,6 | 0,36 0,8 | 0,64 1 | 1 1,2 | 1,44 ... 20 | 400
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.