fork download
  1. #This is my PYTHON program
  2. import math;
  3. K = 22.50;
  4. L = 7.5;
  5. x1 = 0.234;
  6. x2 = 1.426;
  7. x3 = -0.414;
  8. x=y=a=b=float();
  9. print('Please enter value for x/n');
  10. x=float(input());
  11. print("x=,", x)
  12. if x < -2.84:
  13. print('ERROR: the negative value in square root')
  14. else:
  15. a = math.pow((math.exp(-0.5 * math.log(K)) - L * math.log(x)), 2)
  16. print('Result is a=', a)
  17. if x <= 0:
  18. print('ERROR: division by zero or negative value in log')
  19. else:
  20. b = (math.log(x) / math.log(10)) * math.exp(x)
  21. print('Result is b=', b)
  22. if (math.pow(a, 2) + math.pow(b, 2)) == 0:
  23. print('ERROR: division by zero')
  24. else:
  25. y = (4 * a + 3 * b) / (math.pow(a, 2) + math.pow(b, 2))
  26. if a <= 0:
  27. y = math.abs(a - b)
  28. else:
  29. y = math.sqrt(y + b)
  30. print('Result is y =', y)
  31. print('Result is y =', y)
Success #stdin #stdout 0.11s 14212KB
stdin
1
stdout
Please enter value for x/n
x=, 1.0
Result is a= 0.04444444444444445
Result is b= 0.0
Result is y = 9.486832980505136
Result is y = 9.486832980505136