Guest User

Untitled

a guest
Jun 23rd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub ruutv6rrand()
  2.  
  3. Dim a, b, c, dis, x1, x2 As Single
  4.  
  5. a = Cells(2, 2)
  6. b = Cells(3, 2)
  7. c = Cells(4, 2)
  8. dis = (b ^ 2) - (4 * a * c)
  9. If dis > 0 Then
  10. x1 = (-b + Sqr(dis)) / (2 * a)
  11. x2 = (-b - Sqr(dis)) / (2 * a)
  12. Cells(5, 2) = Round(x1, 2)
  13. Cells(6, 2) = Round(x2, 2)
  14.  
  15. ElseIf dis = 0 Then
  16. x1 = (-b) / 2 * a
  17. Cells(5, 2) = x1
  18. Cells(6, 2) = x1
  19. Else
  20. Cells(5, 2) = "Lahend puudub !"
  21. Cells(6, 2) = "Lahend puudub!"
  22. End If
  23. End Sub
Add Comment
Please, Sign In to add comment