Kreis Flächeninhalt
Verfasst: Freitag 16. August 2013, 18:04
Das Programm liefert falsche Ergebnisse. Wäre nett, wenn jemand drüber schauen könnte.
Danke im Voraus.
Danke im Voraus.
Code: Alles auswählen
import math
print "KREIS Flaecheninhalt"
#Eingabe
print "\nRadius (1) oder Durchmesser (2)?"
wahl=int(input())
if wahl==1:
print "Radius:"
radius=double(input())
#Berechnung
a=math.pi*(radius*radius)
print "\nFlaecheninhalt:", a, "Einheit^2"
else:
print "Durchmesser:"
durchmesser=int(input())
#Berechnung
a=(math.pi/4.0)*(durchmesser*durchmesser)
print "\nFlaecheninhalt:", a, "Einheit^2"