Module: Newtest
- Defined in:
- lib/newtest.rb,
lib/newtest/version.rb
Defined Under Namespace
Classes: Error
Constant Summary collapse
- NOTICE =
Your code goes hereā¦
'Hello, I''m Q'
- GUIDE =
%Q{Newtest.giaiPT1 -> Giai PT bac 1 - - - Newtest.giaiPT2 -> Giai PT bac 2}
- VERSION =
"0.0.4"
Class Method Summary collapse
Class Method Details
.giaiPT1(a, b, c) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/newtest.rb', line 8 def self.giaiPT1(a,b,c) if a==0 if b==0 puts 'PT VSN' else puts 'PT VN' end else puts %Q{Nghiem cua PT la: #{-b}/#{a}} end end |
.giaiPT2(a, b, c) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/newtest.rb', line 19 def self.giaiPT2(a,b,c) d = (b*b) - 4*a*c if d<0 puts "PT VN" elsif d==0 puts %Q{PT co nghiem kep: #{-b}/#{2*a}} else e = Math.sqrt(d) puts %Q{PT co nghiem 1: #{-b} - #{e}/#{2*a}} puts %Q{PT co nghiem 2: #{-b} + #{e}/#{2*a}} end end |