Created
December 3, 2013 12:06
-
-
Save utkumalkocoglu/7768154 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Kare | |
| def initialize(kenar) | |
| @kenar=kenar | |
| end | |
| def alan | |
| @kenar*@kenar | |
| end | |
| def cevre | |
| 4*@kenar | |
| end | |
| def kosegen | |
| Math.sqrt(@kenar**2+@kenar**2) | |
| end | |
| end | |
| def main | |
| print " karenin kenar uzunlugunu giriniz:" | |
| a=gets.to_i | |
| d=Kare.new(a) | |
| p "cevre uzunlugu = #{d.cevre}" | |
| p "alan =#{d.alan}" | |
| p "kosegen uzunlugu= #{d.kosegen}" | |
| end | |
| if __FILE__ ==$0 | |
| main | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment